Download as xlsx, pdf, or txt
Download as xlsx, pdf, or txt
You are on page 1of 1

84.

21% 100%
Source code C0 C1
void manageInventory(int inventory, int orders[], int threshold) {
for (int i = 0; i < 8; i++) { O TF
if (inventory >= orders[i]) { O TF
inventory - orders[i]; O
printf("Processed order %d; %d left.\n", i + 1, inventory); O
} else { X
printf("Order %d failed: insufficient inventory.\n", i + 1); O
break; O
}
}
if (inventory == 0) { O TF
printf("Inventory depleted.\n"); O
} else if (inventory <= threshold) { X
printf("Low inventory: %d left.\n", inventory); X
} else { X
printf("Inventory sufficient: %d left.\n", inventory); X
}
}

You might also like