130k views
1 vote
Statement

N students take K apples and distribute them among each other evenly. The remaining (the indivisible) part remains in the basket. How many apples will each single student get? How many apples will remain in the basket?
The program reads the numbers N and K. It should print the two answers for the questions above.

Example input
student: 6
apples: 50

Example output
apples per student: 8
remainder: 2

User Akaru
by
8.0k points

1 Answer

5 votes

Step-by-step explanation:

#include <studio.h>

main()

{

int N, K;

printf("number of students N : ");

scanf ("%d", &N);

printf("Total number of Apples K: ");

scanf("%d", &K);

printf("Apples per student: %d\\", N/K);

printf("Remainder : %d\\", N%K);

}

User Lance Shi
by
8.4k points

No related questions found