+ 1
why?
What is the output of this code? var a = 66; var b = a % 4; var c = b % a; alert(c); answer 2
7 Respostas
+ 2
The "%" operator represents modulus division. It gives the reminder after the division. First operation b = 66 % 4 = 2 (because 16*4= 64 => reminder is 2). Second operation c = 2 % 66 (here the reminder is 2, because 2 < 66).
+ 2
You should get whole number after the division and check the reminder. So in this case it is not possible and 2 is the reminder.
+ 2
Another try to explain it 2 % 66 => 1 times 66 is 66 > 2, so it's not possible, 0 times 66 is 0 and the reminder is 2 - 0 = 2.
+ 1
что именно ты хочешь вывести
0
2/66=0,030303030303
0
почему вторая операция деление по модулю 2%66 равно на 2 ?
0
whenever you do x%y, output will be x if you have y>x == true