+ 2

how the modulous operator work i.e '%' ?

27th Jun 2016, 10:12 AM
DEATH WALKER
DEATH WALKER - avatar
3 odpowiedzi
+ 3
x=a%b is x=a-(largest number that is divsible by b but less than or equal to a) example 100%3 =100-99 =1 13%7 =13-7 =6 15%5 =0 15%0 =0 also keep in mind that we are talking about positive integers.
27th Jun 2016, 11:09 AM
Mukul Kumar
Mukul Kumar - avatar
0
the % divides a number and gives you the remainder. Example: x = 15 % 6; first it will do 15/6 which is 2 and the remainder is 3. 3 gets assigned to x there for x is 3.
28th Jun 2016, 9:27 AM
Armandas Bolevičius
Armandas Bolevičius - avatar
0
'%' operator gives u da remainder wen u divide any two nos. a and b as a/b
1st Jul 2016, 12:32 PM
Pramod Nagaraj
Pramod Nagaraj - avatar