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, 24.06.2019 06:30
Some peer-to-peer networks have a server and some don't. true false
Answers: 2
question
Computers and Technology, 24.06.2019 23:30
Adrian has decided to subscribe for a new internet connection. he wants a high speed connection so that he can stream video content smoothly. which access technology would you advise adrian against using?
Answers: 1
question
Computers and Technology, 25.06.2019 05:30
When a game allows you to pick party members from a large pool, each with different classes and roles but in which no single party combination is clearly superior to others, the game is using: intransitive relationships transitive relationships orthogonal relationships parallel relationships
Answers: 1
question
Computers and Technology, 25.06.2019 08:00
In designing a management information system (mis), after defining the system's objectives, the next step is to information in a useful formatintegrate the hardware and software componentscollect and analyze datause information for decision making
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
question
Mathematics, 23.03.2021 17:30
question
Mathematics, 23.03.2021 17:30
question
Mathematics, 23.03.2021 17:30
Questions on the website: 13722363