Math and Watermelons - Easy Problems - Solution to Toph.co Online Judge Problem

Math and Watermelons

Limits 1s, 512 MB

Your friend has M watermelons. He doesn’t want to share them with anyone, but let’s imagine he would.
He needs to distribute them equally among K people. Given he shares them whole and gives them as many as possible, print how many watermelons would remain after giving every individual an equal number of watermelons.
You can assume that there will be more watermelons than the number of people.

Input

The input will contain two integers: M (K < M < 1000000) and K (0 < K < 100).

Output

Print the number of remaining watermelons.

#include<stdio.h>


int main()
{
    int m,k;
 scanf("%d %d", &m, &k);
 
 printf("%d",m%k);

    return 0;

}