# Math and Watermelons

Your friend has M watermelons. He doesn’t want to share them with anyone, but let’s imagine he would…

If you need help solving this problem, mention your approach and ask specific questions. Please avoid sharing your code and asking the Community to figure out “what’s wrong”.

can’t understand where is my problem ``````M = int(input())
K = int(input())
a = M / K
b = int(a)
c = b * K
d = M - c
print(d)
``````

worked in other python3 ide,but not working in here answer is also correct but saying runtime error The way you are taking inputs is incorrect.
try,

``````N, M = map(int, input().split())
``````
1 Like
``````water_melons=int(input())
mens=int(input())
c=int(water_melons/mens)
d=int(c*mens)
e=water_melons-d
print(e)
``````

my output is always correct but all time tells runtime error

Why are you doing this when you solve this problem in 2 line code like this:

``````m,k=map(int,input().split())
print(m%k)``````
``````#include<Stdio.h>
int main()
{
int M,K,a;
scanf("%d %d",&M,&K);
a=M%K;
printf("%d",a);

return 0;
}
``````

where was the problem , compile error

``````package toph;

import java.util.Scanner;

/**
*
* @author Md Rifat
*/
public class MathandWatermelons {
public static void main(String[] args) {
Scanner in=new Scanner(System.in);
int M,K,a;
M=in.nextInt();
K=in.nextInt();
a=M%K;
System.out.println(a);
}
}
``````

runtime error. How can I solve this problem

I know why you got RE.
There is problem to your code with taking input.
You should take input as:
`M k`
Not

``````M
K
``````

In python some people do mistake as they take input as:

``````M = int(input())
K = int(input())
``````

But they should do this to get AC:

``````M,K = map(int,input().split())
``````

in java how can i input multiple values in one line . if you know that please tell me . thank you

@Rifat.or I think that will help.

``````String input = scanner.nextLine();    // get the entire line after the prompt
String[] numbers = input.split(" "); // split by spaces
``````

P S : I don’t know java well. You can search google.

i can’t find anything form google

//instagram.com/saque_lain

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

``````int x, y;
scanf("%d %d", &x, &y);
printf("%d", x%y);

return 0;
``````

}

This is simplest solution and it worked.
#include
using namespace std;
int main() {
int water;
int people;
cin>> water >> people;
int res = water % people;

``````cout<<res;
return 0;
``````

}