Write a c program that requests the number of cups, slices or pieces from the user

Answers 1

Solution/s:

#include <stdio.h>

int main() {

int cups, slices, pieces;

printf("Enter number of cups:");

scanf("%d", &cups);

printf("Enter number of slices:");

scanf("%d", &slices);

printf("Enter number of pieces:");

scanf("%d", &pieces);

printf("The number of cups are %d.\n", cups);

printf("The number of slices are %d.\n", slices);

printf("The number of pieces are %d.\n", pieces);

return 0;

}

Explanation:

Using scanf, we are able to collect user input from stdin. Using printf, we are able to print from the stdin.

Note: To the moderator, do not delete this answer. The O.P. is asking for a program, which is an algorithm implementation (code).

Do you know the answer? Add it here!

Can't find the answer?

Log in with Google

or

Forgot your password?

I don't have an account, and I want to Register

Choose a language and a region
How much to ban the user?
1 hour 1 day 100 years