Task 3%6, output 3. How come? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Task 3%6, output 3. How come?

Task 3%6, output 3. How come?

29th Apr 2021, 4:05 PM
Anna Pavlova
Anna Pavlova - avatar
5 Answers
+ 1
% first divide the number an then return the reminder so if we want to divide 3 by 6 first we should multiple 6 by zero then we need to subtract 3 by zero which will have the reminder of 3 : 3 / 6 -> 6 X 0 = 0 -> 3 - 0 = 3 -> reminder is 3
29th Apr 2021, 4:13 PM
Nima
+ 4
Anna Pavlova % is known as modulus operator which returns reminder so here reminder will be 3 3 % 6 = 6 * 0 + 3 = 3
29th Apr 2021, 4:08 PM
A͢J
A͢J - avatar
+ 1
% operator gives remainder after division So 6 % 3 when u divide the quotient will be 0 and remainder will be 3 So ans will be 3
29th Apr 2021, 4:09 PM
kris
kris - avatar
+ 1
6 ) 3 (0 0 --------------- 3 3/6 as quotient is 0(full int) . so the remaining remainder is 3 itself.
29th Apr 2021, 4:09 PM
TOLUENE
TOLUENE - avatar
+ 1
% is modulus meaning returns the remainder. ___________ divisor | divident | quotient x - - - - - - - - - - remainder example: 3%6 ___ 6 | 3 | 0 0 - - - 3 - > so this is remainder and hence the result to 3%6
29th Apr 2021, 4:09 PM
Rohit Kh
Rohit Kh - avatar