I can't understand remainder portion, any one can help me? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I can't understand remainder portion, any one can help me?

20th May 2017, 3:28 PM
Ayush Dogra
Ayush Dogra - avatar
5 Answers
+ 4
% operator returns the remainder of division. For example, when 5 is divided by 2, 2 is the quotient and 1 is the remainder (5 = 2 * 2 + 1). 5 % 2 = 1 is it's representation.
20th May 2017, 3:46 PM
Krishna Teja Yeluripati
Krishna Teja Yeluripati - avatar
+ 3
Maybe if it would have been better if you could explain more.
20th May 2017, 3:34 PM
Wilson Bol
Wilson Bol - avatar
+ 3
It returns a remainder: E.g 1: 6%2 evaluates to 0 because there's no remainder if 6 is divided by 2 ( 3 times ). 2: 7%2 evaluates to 1 because there's a remainder of 1 when 7 is divided by 2 ( 3 times ).
20th May 2017, 3:48 PM
Wilson Bol
Wilson Bol - avatar
0
how % function work... What it do?
20th May 2017, 3:36 PM
Ayush Dogra
Ayush Dogra - avatar
- 1
If you have 3 apples, and there are 2 people. 1 apple remains. 3 % 2 = 1 1 apple is the Remainder.
19th Apr 2018, 11:44 AM
Wenwin