**New course!**Every coder should learn

**Generative AI!**

+ 1

# why 1.25 % 0.5 is 0.25

i dont get it

13 Answers

+ 21

2 * 0.5 = 1
1.25 - 1 = 0.25
Basically very time you can try to get the closest to the first number (1.25) by multiplying the second (0.5) with another number (2) and then subtracting it from the first one (1.25) to get the answer.
And by the way 1.25 / 0.5 = 2.5

+ 6

2 * 0.5 = 1
so the remainder 1.25 - 1 = 0.25
good luck bro ❤

+ 5

Its basic math.
Just remember that % (modulo) is not same as / (divide)
% will give you remainder after division.
so 1.25/0.5 (devide by) will be give you 2 as dividend and 0.25 as remainder

+ 3

You divide 1.25 with 0.5 and then obtain the remainder, that'll be your answer.
So it goes,
1.25 / 0.5 = 2 (remainder: 0.25)
'%' is a modulo operator that yields the remainder of a problem.

+ 2

1.25 == (1.25//0.5)*0.5 + 1.25%0.5 == 2*0.5 + 0.25

+ 1

1 % 2 = 1(1 - 0), 20 % 8 = 4(20-16)

0

6%20 =2
is not this correct?

0

1.25 divided by 0.5 is 2 + the reminder of 0.25, then 1.25 % 0.5 = that reminder of 0.25

0

why reminder is 0.25?

0

>>>7%(5//2)
=7%2
=1
above if you do 7/2 then you will get 3.5
Let's simple it if the ans is 3.5 then substract 2(quotient) from 7 ,3 times (7-2-2-2)=1.Thus above ans of >>>7%(5//2)=1
Apply same theory for the problem >>>1.25%.5
Here if we do 1.25/.5 we surely get 2.5. Now subtract the 0.5(quotient ) from 1.25 by 2 times(1.25-0.5-0.5)=0.25 .. Thus the real solution and perfect solution we get from modulo operation

0

https://ru.wikipedia.org/wiki/Деление_с_остатком

0

If you have 10 cookies and each kid gets 2 cookies, how many kids can you serve? It's 10÷2=5 kids.
If you have 10 cookies and each kid gets 2.5 cookies, how many kids can you serve? It's 10÷2.5=4 kids.
If you have 1 cookie and each kid gets 0.5 cookies, how many kids can you serve? It's 1÷0.5=2 kids.
what is left is the remainder 0.25

- 3

did the math within my calculator and this is what came out: 0.00625