subject

Given the number of people attending a pizza party, output the number of needed pizzas(not number of slices) and total cost. For the calculation, assume that people eat 2 slices on average and each pizza has 12 slices and costs $14.95. Output each floating-point value with two digits after the decimal point, using the precision format string in the printf() function call.

Example: printf("$%.3lf\n", 12.94444); would print "$12.944" and a new line.

The challenge to getting all credit will be to ensure that the number of pizzas is rounded upwards so that there is enough pizza for the average consumption of 2 slices per person rather than the total number of slices needed. For example, 6 people need 1 pizza….what about 7 people?

Ex: If the input is:

4
the output is:

Pizzas: 1
Cost: $14.95
Hint: Use the ceil() function to round up the number of pizzas so that enough pizzas are ordered.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 21:30
After you clean an engine with hot water spray, it seems to stall; when it doesn't stall, it's idling noisily. technician a says to check for loose bolts on the flex plate near the torque converter. technician b says to wipe down the spark plug wires and the distributor cap. who is correct? a. technician a b. both technicians a and b c. technician b
Answers: 1
question
Computers and Technology, 23.06.2019 04:20
Which network media uses different regions of the electromagnetic spectrum to transmit signals through air? uses different regions of the electromagnetic spectrum to transmit signals through air.
Answers: 2
question
Computers and Technology, 23.06.2019 06:30
On early television stations, what typically filled the screen from around 11pm until 6am? test dummies test patterns tests testing colors
Answers: 1
question
Computers and Technology, 24.06.2019 06:30
Some peer-to-peer networks have a server and some don't. true false
Answers: 2
You know the right answer?
Given the number of people attending a pizza party, output the number of needed pizzas(not number of...
Questions
Questions on the website: 13722367