How the output comes 50? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 9

How the output comes 50?

A = 96 B = 50 B%A = ?

19th Jul 2020, 12:05 PM
Sarfira
Sarfira - avatar
60 Answers
+ 13
Learner🎯 50÷96 not 96÷50 So the remainder would be 50
19th Jul 2020, 12:10 PM
Nilesh
+ 7
Because when you divide 50/95 the remainder left is 50 and that what is returned by the modulo("%") operator.
19th Jul 2020, 12:07 PM
Arsenic
Arsenic - avatar
+ 6
You only see this 96 | 50 | 0 - 0 -------------------- 50 -------------------- the remainder would be fifty only na? Because the number 50 is'nt divisible by 96
19th Jul 2020, 12:07 PM
Nilesh
+ 6
Learner🎯 When there is A % B then reminder will be 46 but there is B % A that's why reminder is 50. A % B = 96 % 50 //reminder 46 B % A = 50 % 96 //reminder 50
19th Jul 2020, 1:42 PM
A͢J
A͢J - avatar
+ 6
If in B % A B < A, then it will return B🙂
20th Jul 2020, 8:17 AM
Damir Temirgaliy
Damir Temirgaliy - avatar
+ 4
Learner🎯 you are not doing 96/50 instead you are performing 50/96. Just have a look at it.
19th Jul 2020, 12:10 PM
Arsenic
Arsenic - avatar
+ 4
See, you are dividing 50 by 96 not 96 by 50. The rest process is already being answered. If you'll divide 96 by 50 then, then the quotient will be 1 and remainder Will be 46. Always remember that sequence really matters. Let's say you have to subtract 30 from 50. Then the result will be 20. But if I say, subtract 50 from 30 Then, the result will be -20. And there is much difference between 20 and -20 Same case here also.
19th Jul 2020, 12:14 PM
Arctic Fox
Arctic Fox - avatar
+ 3
Sorry ! I am confused
19th Jul 2020, 12:11 PM
Sarfira
Sarfira - avatar
+ 3
Learner🎯 Easy trick: 1st number less than 2nd number answer is 1st number. 2%7=2 5%10=5
19th Jul 2020, 12:14 PM
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜ - avatar
+ 3
Thanks all ! I was little bit confused. Now everything is clear.
19th Jul 2020, 12:14 PM
Sarfira
Sarfira - avatar
+ 3
Learner🎯 Swim is correct. Your doubt confused me too😅 I read my answer again and realised that it's wrong so, I have corrected it. You can check
19th Jul 2020, 12:29 PM
Arctic Fox
Arctic Fox - avatar
+ 3
Learner🎯 You should not ask more than one question of two different types in the same thread. Better to create a new thread
19th Jul 2020, 12:42 PM
Arctic Fox
Arctic Fox - avatar
+ 3
A%B=46 50)96(1 50 __ 46 __ B%A=50 96)50(0 00 __ 50 __
20th Jul 2020, 9:57 AM
Mirza Abdul Gani Baig
Mirza Abdul Gani Baig - avatar
+ 3
Because: (50/96) = ((0*96)+50) So, the remainder is 50(the output of code)
20th Jul 2020, 1:00 PM
Dimitris N. Kapoulas
Dimitris N. Kapoulas - avatar
+ 2
Learner🎯 quotient is 0 and remainder is 50
19th Jul 2020, 12:09 PM
Arsenic
Arsenic - avatar
+ 2
Yup,now you are correct 96//50 would be what? The quotient would be 1 only And remainder is 46 then. You have used there 50//96. So, the remainder Will be 50 And quotient is 0. Whenever, you'll get confused with this. Try putting values in the variables where they are used like: It's B%A so, put the values there 50%96.
19th Jul 2020, 12:22 PM
Arctic Fox
Arctic Fox - avatar
+ 2
~ swim ~ thank u bhaiya
19th Jul 2020, 12:29 PM
Sarfira
Sarfira - avatar
+ 2
Learner🎯 your question going to become a 'Hot today' question.☺☺☺☺
19th Jul 2020, 12:32 PM
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜
˜”*°•.˜”*°• Mohan 333 •°*”˜.•°*”˜ - avatar
+ 2
= 0 ---- 96 )50 0 ------ 50 Here the remainder is 50.
19th Jul 2020, 1:45 PM
MSN
MSN - avatar
+ 2
Zeeshan Khan you should post your question in new thread brother every query should be related to a particular topic otherwise it will be mess up.
20th Jul 2020, 6:14 PM
Sarfira
Sarfira - avatar