+ 1

Hello! Somebody explain me how is taking division from remainder, for example a%2, where 'a' value is zero, one, two...

Sometimes I forget how it working 😅

2nd May 2020, 10:52 AM
Vladimir Kushner
Vladimir Kushner - avatar
2 Antworten
+ 4
It is simple it told us in our school days when we devide 0 with any no then it will be divisible with quotient 0 and remainder 0 . Next we will devide 1 with 2 then then obviously we can't do that because 1 is an int and 2 is also an int . So it will result in float so here it will simply return 1 as remainder because it will not devide 1 . And for 2 you know that it is completely divisible by itself so no remainder.
2nd May 2020, 11:23 AM
Ayush Kumar
Ayush Kumar - avatar
+ 2
ok, thanks for remember, I see when we get a float result it remain us logical "1".
2nd May 2020, 12:12 PM
Vladimir Kushner
Vladimir Kushner - avatar