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:
Verified
Q24: What is the meaning of x =
Q26: Consider the following Java variable names:
I.1stInstance
II.basicInt%
III.empName_
IV.addressLine1
V.DISCOUNT
Which of
Q37: Which one of the following is a
Q38: Which one of the following is an
Q78: What is the value of the following
Q82: What is wrong with the following code
Q83: What is wrong with the following code
Q84: Suppose a phone number, stored as a
Q92: The problem solving process emphasizes a "first,
Q122: What is the correct way to invoke
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents