+ 1
remainder
3 odpowiedzi
+ 10
If we divide 1.25 by .5 than, we can write:
1.25= .5*2(here .5*2=1)+.25 (here .25 is remainder, here further division approaches not followed as normal mathematical process follows, in normal mathematical process, we can write 1.25/.5 = 2.5)
hence,
1.25 divided by .5, quotient is 2 and .25 isn't divided by .5 so it is remainder.
above term is expressed by modulus sign (%),where % shows only remainder,not shows quotient.
it is expressed by
5%2 = 1
11%4 = 3
5%3 = 2
3%5 = 3
6%5 = 1
12%7 = 5
2%2 = 0
1.25%.5 = .25
+ 4
I made a function that calculates the remainder. It will give the same output as x%y.
# works for positive numbers
def remainder(x, y):
z = x
i = 1
while z >= y:
z = x - (y * i)
i += 1
return z
x = 57
y = 6
u = remainder(x, y)
print (u)
v = x % y
print (v)
0
remainder means the value which is remain left after division it also called modulos operator (%)
ex:- 5%2=1
10%2=0
division
5/2=2
10/2=5