Toph easy problem(Math and Watermelons)

Question:

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, 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 (K < 100).

Output

Print the number of remaining watermelons.

Samples

InputOutput
10 3

Solve in C:

#include<stdio.h>
int main(){

int m,k,val;
scanf("%d %d",&m,&k);
val=m%k;
printf("%d",val);
return 0;

}



1

No comments

Most View Post

Recent post

Codeforces Round 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

  Problem Link    https://codeforces.com/contest/2009/problem/C S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. h ...

Powered by Blogger.