what get returned when 4%6 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 6

what get returned when 4%6

21st Feb 2019, 4:16 PM
ᎯᏰᏰᎯ__ᏥᎿᏩ➰
ᎯᏰᏰᎯ__ᏥᎿᏩ➰ - avatar
9 Answers
+ 4
Remember that if the first number is smaller then the second in modulo case the answer will be the first number always..
21st Feb 2019, 8:52 PM
Faraz Ali Arain
Faraz Ali Arain - avatar
+ 5
Ask yourself two questions: 1.) How often does the 6 fit into the 4? 2.) And after that: How much will be left over?
21st Feb 2019, 7:32 PM
HonFu
HonFu - avatar
+ 4
is it that you return 4 or how does it work
21st Feb 2019, 4:16 PM
ᎯᏰᏰᎯ__ᏥᎿᏩ➰
ᎯᏰᏰᎯ__ᏥᎿᏩ➰ - avatar
+ 4
it will return 4 calculation : 4 % 6 means 6) 4 (0 (QUOTIENT) - 0 ==== 4 (REMAINDER) since the modulus operator returns remainder the result is 4
22nd Feb 2019, 4:56 AM
sree harsha
sree harsha - avatar
+ 3
The modulus operator returns the numerator if it is less than denominator!
23rd Feb 2019, 2:38 PM
NANDHINISRI S
NANDHINISRI S - avatar
+ 3
Yeah... The % symbol is a binary connector that returns the remainder of the dividion... When: 4%6: we have no whole number quotient, but the remainder is 4 It returns 4
23rd Feb 2019, 5:59 PM
Olaoluwa Malachi
Olaoluwa Malachi - avatar
+ 3
Since 6 can't divide 4,the result would be zero remainder four. Therefore 4%6 = 4 (the remainder)
1st Mar 2019, 9:23 AM
Odumodu Okwudili Joshua
Odumodu Okwudili Joshua - avatar
+ 2
The return is 4
27th Feb 2019, 1:11 AM
Alpha
Alpha - avatar
0
As the % is a Modules Operator. When ever we take a modules of two operands. As (Operand_1) % (Operand_2) If the Operand_1 is higher then the Operand_2 then it will divide the Operand_1 with Operand_2 and will return the Remainder but if the Operand_1 is smaller then the Operand_2 then it will simply return back the Operand_1! as in your case 4 is smaller then 6 so its answer will be 4%6 and it will return you back 4
13th Oct 2020, 1:21 PM
Abdul Rehman
Abdul Rehman - avatar