Welcome to Westonci.ca, your ultimate destination for finding answers to a wide range of questions from experts. Our platform offers a seamless experience for finding reliable answers from a network of knowledgeable professionals. Get immediate and reliable solutions to your questions from a community of experienced professionals on our platform.

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.

Sagot :

We have that the print command of the code  is mathematically given as

   printf("Pizzas: %d\n",numPizzas);

   printf("Cost: $%.2f\n", cost);

   return 0;

Programming

We take into  consideration the the parameters

  • Assume that people eat 2 slices on average
  • and each pizza has 12 slices and
  • costs $14.95.

Generally the Program that defines the result

   int main() {

   int Humans;

   int numPizzas;

   double cost;

   scanf("%d",&Human);

   numPizzas = ceil((2*people) / 12.0);

   cost = numPizzas * 14.95;

   printf("Pizzas: %d\n",numPizzas);

   printf("Cost: $%.2f\n", cost);

   return 0;

For more information on Programming visit

https://brainly.com/question/13940523