- 4
How to calculate the remainder
12 Respostas
+ 9
use them for solving gcd
+ 8
How old are you @3ly mofty?
+ 7
mathematically :
11%3 = 3 x 3 + 2
so the output is 2
10%3 = 3 x 3 + 1
so the output is 1
9%3 = 3 x 3 + 0
so the output is 0
8%3 = 2 x 3 + 2
so the output is 2
7%3 = 2 x 3 + 1
so the output is 1
+ 6
Use the modulo operator %
11 % 3 = 2
+ 6
Imagine you have a and b.
a = 11 and b = 3
You substract the product of (('a' divided by 'b') times 'b') from 'a'.
Example in C#:
https://code.sololearn.com/c6e0kzR7UpX7/?ref=app
+ 5
It divides a by b and returns the remainder
+ 5
Then ask it like this in your main question next time please (-':
+ 5
If you do it on paper :
3 ) 40 ( 13 "this is the answer"
3
----
10
9
----
1 "this is the remainder"
40 divided by 3 results 13 and remainder is 1.
0
Okay but how it works mathematically
- 1
Greaaaaaaat thanks guys
- 3
Thats not my question i ask about how do i can calculate it manually by myself on paper
- 3
I didnt know how to ask it