Explain please | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Explain please

var a=1%5; document.write(a); ans- 1 how ?????? please give me your lil valuable time n explain:)

13th Dec 2016, 6:28 PM
Kara
Kara - avatar
15 Answers
+ 4
I know but how .... 6%5=1 fine but 1%5=1 ????
13th Dec 2016, 6:43 PM
Kara
Kara - avatar
+ 4
1 = (5x0) + 1 quotient 0. remainder 1
13th Dec 2016, 6:54 PM
Rishi Anand
Rishi Anand - avatar
+ 3
thank you both of you:)
13th Dec 2016, 8:18 PM
Kara
Kara - avatar
+ 3
@paul yes I'm :)
14th Dec 2016, 2:41 PM
Kara
Kara - avatar
+ 3
@paul delete your no. I almost add you:)
14th Dec 2016, 4:09 PM
Kara
Kara - avatar
+ 2
@rishi but still having problem by the way so thanks
13th Dec 2016, 6:59 PM
Kara
Kara - avatar
+ 2
when 6%5 then the quotient will be 1 so 5*1=5 =>6 - 5=1 so the remainder comes 1 and when 1%5 then the quotient will be 0 so 5*0=0 =>1- 0=1 so the remainder comes 1
13th Dec 2016, 7:39 PM
Ravindra
Ravindra - avatar
+ 2
It is cuz u cant put 5 to 1 even once. And 1 just stay 1. Thats work with any numbers if divider much than divideble. 4 % 5 = 4
13th Dec 2016, 8:22 PM
LoooooooL
LoooooooL - avatar
+ 2
The modulus is just the remainder of the division of the two numbers for example 1%5=1 because 1 divided by 5 is 0 remainder 1
20th Dec 2016, 2:26 AM
Awodire mayor
Awodire mayor - avatar
+ 1
This is simple maths Kara. When you try to divide 1 by 5. Think, what would you get as remainder
13th Dec 2016, 7:06 PM
Rishi Anand
Rishi Anand - avatar
+ 1
The modulus of a number in which the first number is lower than the second number...the first number is the modulus of the operation example: 1%5 => 1 ....2%5 => 2. ........... it is applicable to all numbers ....even 6 % 7 => 6..........
14th Dec 2016, 3:33 PM
Awodire Babajide Samuel
Awodire Babajide Samuel - avatar
0
% or modulo operator returns the remainder of the division. If you divide 1 by 5 the remainder will be 1
13th Dec 2016, 6:35 PM
Rishi Anand
Rishi Anand - avatar
0
Hey Kara, are you available on WhatsApp?
14th Dec 2016, 1:17 PM
Ayokunle Paul
Ayokunle Paul - avatar
0
the modulus is just the remainder of the division of the two numbers for example 1%5=1 because 1 divided by 5 is 0 remainder 1
20th Dec 2016, 2:25 AM
Awodire mayor
Awodire mayor - avatar
- 2
Send your number.
14th Dec 2016, 3:41 PM
Ayokunle Paul
Ayokunle Paul - avatar