0

What this ℅ means divide or not... becoz 1.25÷0.5 is 2.5 not 0.25

14th Feb 2018, 12:37 PM
Super Wolves
6 Respostas
+ 3
It returns remainder of division. Example: 10 % 4 is 2 because remainder in 10 / 4 is 2. 10 % 5 is 0 because remainder is 0.
14th Feb 2018, 12:44 PM
Sad
Sad - avatar
+ 3
% is modulo. It is the remainder. That is what is left over after you have divided the numbers. 1,25 / 0,5 = 2 1,25 % 0,5 = 1,25 - 1 = 0,25
14th Feb 2018, 12:45 PM
sneeze
sneeze - avatar
+ 1
you're supposed to get 0 for this calculation if you use % % returns remainder after an integer division
14th Feb 2018, 12:43 PM
‎ ‏‏‎Anonymous Guy
+ 1
@Sreejith That depends on the language.
14th Feb 2018, 1:21 PM
Vlad Serbu
Vlad Serbu - avatar
+ 1
I tested in C#. It is allowed to calculate the remainder of floating point numbers. https://code.sololearn.com/cEIQ0K4jiE0t
14th Feb 2018, 10:49 PM
sneeze
sneeze - avatar
0
@sneeze you cannot use modulus operator for float data type that's illegal
14th Feb 2018, 1:00 PM
‎ ‏‏‎Anonymous Guy