0
What this â means divide or not... becoz 1.25Ă·0.5 is 2.5 not 0.25
6 Answers
+ 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.
+ 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
+ 1
you're supposed to get 0 for this calculation if you use %
% returns remainder after an integer division
+ 1
@Sreejith
That depends on the language.
+ 1
I tested in C#.
It is allowed to calculate the remainder of floating point numbers.
https://code.sololearn.com/cEIQ0K4jiE0t
0
@sneeze you cannot use modulus operator for float data type
that's illegal