0

Java Script

What is % sign for ?

4th Feb 2017, 2:50 PM
Nathanael Tjandra
Nathanael Tjandra - avatar
4 RĂ©ponses
+ 7
Yes: in other words, modulo is operator that return the reminder of the integer division ;)
4th Feb 2017, 3:18 PM
visph
visph - avatar
+ 4
Integer division of A by B stand for 'how many integer times is B in A... Take 15 divided by 3, 3 fit 5 times, exactly so in integer division 15 / 3 equals 5, 0 left-over... Take now 16 / 3 equals 5 also, but 1 left-over, and so on... next number with remainder 0 is next multiple of 3 ( B ), so 18 / 3 equals 6 remainder 0... % is operator for the left-over ( remainder ) part of the integer division ^^ Not sure to better explain, but I tried :P
7th Feb 2017, 2:50 AM
visph
visph - avatar
+ 3
I think it is meant to be modular arithmetic sign. Ex: 5 (mod 2) = 1 => a (mod b) = c -> a= b.k + c , k is a decimal as ...-1, 0, 1, 2,... so, var a = 5%2 now a variable is 1
4th Feb 2017, 2:58 PM
Pamir Ünsal
Pamir Ünsal - avatar
0
I dont understnd and i wonder too😞
6th Feb 2017, 9:36 PM
Viggo Richter
Viggo Richter - avatar