heeeeelp! why is 1.25%0.5=0.25????? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

heeeeelp! why is 1.25%0.5=0.25?????

12th Sep 2016, 4:56 AM
wahu kinuthia
wahu kinuthia - avatar
10 Réponses
+ 9
1.25 mod 0.5 = 0.25 1.25 = 0.5 + 0.5 + 0.25
12th Sep 2016, 5:49 AM
Fredrik
Fredrik - avatar
+ 3
'%' gives the remainder as the answer whereas '/' gives the quotient.
12th Sep 2016, 7:09 AM
Sankara Srikrishna Topella
Sankara Srikrishna Topella - avatar
+ 2
1.25/0.5=2 rest 0.25 <------
12th Sep 2016, 7:42 AM
Fredrik
Fredrik - avatar
0
% gives reminder
13th Sep 2016, 4:44 AM
Abdul Azeez
Abdul Azeez - avatar
0
why isn't 0.5?
24th Sep 2016, 2:21 PM
Wagner Pansard
Wagner Pansard - avatar
0
0.5)1.25(2 1 0.25 (After Subracting 1.25 with 1)
29th Jun 2017, 11:49 AM
rajamanickyam s
rajamanickyam s - avatar
0
'%' is not equal to '/'
24th Aug 2017, 3:24 AM
常永盛
常永盛 - avatar
0
0.25
10th Jul 2019, 2:04 AM
Tsûrūgï Mj Zërø
Tsûrūgï Mj Zërø - avatar
0
IF anyone remembers doing long division by hand (back when you had to walk to school uphill, both ways, in the snow). .5⟌1.25 .5 goes into 1 2 times (.5*2 = 1) 2 .5⟌1.25 -1.00 .25 when you subtract the 1 from 1.25, you get the REMAINDER which is .25. That is what the modulo "%" is referring to. If you do regular division of "how many times does .5 go into 1.25", that is 2.5, and where I personally was confused to begin with. Funny that you have to go old school to learn new code. :)
27th Jun 2020, 8:34 PM
Beata Meyers
Beata Meyers - avatar
0
Simple. How many half (0.5) in the 1 and quarte (1.25)? The answer is there 2 halfs (0.5 0.5) in the one and quarter (1.25) But when we add 0.5 to 0.5 it will equal one only 1!! not 1.25. So 0.25 are remaining So % means how much are remaining when we count how many 0.5 inside the 1.25.
11th Dec 2022, 6:32 AM
Ahmed El-Faleh
Ahmed El-Faleh - avatar