Help! Write a program to prompt the user for the number of people at a party and
ID: 3747077 • Letter: H
Question
Help!
Write a program to prompt the user for the number of people at a party and the number of pizza slices each person is expected to eat and output the number of pizzas that should be ordered. It is not possible to order a partial pizza. It is ok to have leftover pizza, but it is not ok to not have enough for everyone to eat. You can assume that the number of slices each person will eat will be a positive number greater than zero. Assume that a pizza has eight slices.
output should be;
How many people will there be? 4
How many slices will each person eat? 3
You should order 2 pizzas.
Explanation / Answer
THE PROGRAM YOU REQUIRED IS GIVEN AS BELOW CODED IN C LANGUAGE,
#include <stdio.h>
#include <math.h>
int main(){
float people, piece, total, slicesinonepizza=8;
printf("Enter total number of people in party");
scanf("%f",&people);
printf("Enter total number of pieces");
scanf("%f",&piece);
total = (people*piece)/slicesinonepizza;
int answer= ceil(total);
printf("Total number of pizzas required are %d",answer);
return 0;
}
IT YOU HAVE ANY DOUBTS OR ARE NOT ABLE TO FOLLOW ANY OF MY STEPS PLEASE COMMENT.
Cheers:)
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.