+ 1
% operator
Hi, friends! Can any1 tell me the result of "2%4"? And explane how this stuff works. Thank u Mb, for example some expressions: 2%5 =? ; 3%10=?
7 Antworten
+ 4
% is an “operator” that ussually represents modulus.
Modulus is basically just a fancy term for remainder.
So 3%2 will be 1
4%2 will be 0
5%3 will be 2
etc...
Edit:
When the number is being “modulused” by a number bigger than it than it is just that number.
Ex:
1%100 is 1
50%100 is 50
2%5 is 2
etc...
+ 3
Here the result from your question:
2%4 result is 2
2%5 result is 2
3%10 result is 3
+ 2
Coder Kitten Half cookie each...😂
Sorry I couldn't help it...
+ 1
I understand what will be 3%2, 4%2 or 5%3
But I cant understand expressions when first number higher than second, for example, 2%4, 2%5,3%10
Or it is the same result?
+ 1
Результатом є лише остаток від ділення - незалежно від того який результат самого діження...
+ 1
Thank you, guys, now I think know how it works ;)
0
5%2=1
5/2=2