0
7%(5//2). If i understand correctly, 5//2 equals 2. If u devisen 7/2 the remainder should be 0.5 right? Wrong.. What am I missing?
5 odpowiedzi
+ 3
Yes you are right for this (5//2) = 2
but 7%2 = 1 not 0.5
remainder is 1 not 0.5
+ 2
Yeah, 5//2 equals 2. But remainder after divide 7%2 equals 1. It is not a decimal part of the result. It is a integer (whole number) remainder from the calculation.
Let see.. 7//2 is 3 3x 2 = 6. So the reminder till 7 is one...The same like quickly 7 %2.
+ 2
You're confusing long division, fractions and floats (decimal numbers). In long division:
quotient R remainder
___________
divisor ) dividend
-(q*d)
----------
new dividend
2 R 1 3 R 1
___ ___
2)5 2)7
-4 -6
-- --
1 1
To write those as fractions you write the quotient, then the remainder over the divisor (producing numerator / denominator) :
2 1/2 and 3 1/2 (or 2.5 and 3.5)
The 0.5 portion is in the tenths (not tens) place and is the same as writing 5/10...or 1/2.
To reverse a fraction like this you:
denominator * whole integer + numerator (remainder). 2*2+1=5 and 2*3+1=7
For // division, only the integer quotient is returned.
For % division, only the integer remainder is returned.
For / division, the remainder is converted to a decimal fraction and appended to the quotient.
0
divide*
0
yes!! 7%2 is 1 not 0.5