Solved

When You Purchase Donuts, They Come in Boxes of 12

Question 4

Multiple Choice

When you purchase donuts, they come in boxes of 12, so 24 donuts take 2 boxes.All donuts need to be in a box, so if you buy 13 donuts, you'll get 2 boxes with 12 in the first box and 1 in the second.If the integer variable numberOfDonuts contains the positive number of donuts purchased, which of the following will correctly give the number of boxes needed?


A) int numberOfBoxes = (numberOfDonuts + 11) / 12;
B) int numberOfBoxes = numberOfDonuts / 12;
C) int numberOfBoxes = 1 + numberOfDonuts / 12;
D) int numberOfBoxes = numberOfDonuts / 12 + numberOfDonuts % 12;

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions