Menu Close

[C-Program]Sharing Food Equally…FcukTheCode

Ramesh is working in an engineering college hostel as a Mess supervisor. There are different messes are available based on the years. Every day students count is varying in all the hostels due to continuous holidays.

Since ramesh is in charge of the cooking team. He had trouble with calculating the quantity of food that needs to be prepared because of the varying student count.

Even if a small quantity of food is prepared by the cooking team, it should be divided equally among the number of Mess.Ramesh needs an automated software to identify the amount of food available (in number of packets ) and Mess count. 

Can you help him to divide the food equally and also calculating the remaining quantity of food that will be available after sharing the food equally ?

Input:
Only line of input has two integer representing the available number of food packets and the available number of messes.

Output:
In the only line of output print two values separated by a space representing the number of food packets are shared and the remaining number of food packets available.
#include <stdio.h>
int main()
{
    int alvqntoffood,messcnt,dividedqnt,remfood;
    scanf("%d",&alvqntoffood);
    scanf("%d",&messcnt);
    dividedqnt=alvqntoffood/messcnt;
    remfood=alvqntoffood%messcnt;
    printf("%d",dividedqnt);
    printf(" ");
    printf("%d",remfood);
    return 0;
}

Input_1:
25575  5

Output:
5115  0


Input_2:
7567  11
Output:
687  10


 


Input_3:
6550  3

Output:
2183  1


Input_4:
7000  10

Output:
700  0


Input_5:
1000  7

Output:
142  6