- 2
I am confusing in quotient and remainder topic.. so can u elobrate it??
3 Respostas
+ 12
Try to divide 10 chocolates among 3 kids EQUALLY.
How many chocolates does each child get?
3
3 is the quotient (10/3 = 3)
After dividing equally, how many chocolates remain?
1
1 is the remainder (10%3 = 1)
If no chocolates would remain (like dividing 10 among 5 kids), we could say that the remainder is 0. In other words, 10 is divisible by 5. (10%5 = 0)
+ 6
Quotient is usually refered to as the integer portion of the result of division. So in 12/4 the quotient is 3. 10 / 4 the quotient would be 2.
Remainder or modulo is the remaining portion or the fractional part of the result from division. So in 12/4 the modulo or remainder would be 0, as 4 goes into 12 exactly 3 times. In 10/4, 4 goes into 10 two times leaving 2 remaining. 4*2=8 10-8=2
% is the modulus operator in most programming languages including Python. 10%4=2
In python there is a built in function called divmod() that takes in 2 numbers and returns both the quotient and the modulo. The first is the numerator the second is the denominator.
q, m = divmod(10, 4)
q is the quotient and will be equal to 2
m is the modulo and will be equal to 2
0
u jst have to use floor operation for quotient and modulo for remainder..