+ 6
Why modulus (%) operator gives different result in compiler and calculator ?
I am beginner and I face a problem with modulus operator. Please tell me reason !! =>> In Compiler <== 1%2 = 1 2%1 = 0 ____________________________ =>> In Calculator <<= 1%2 = 0.02 2%1 = 0.02
4 Answers
+ 28
@Waqas
Kuba is right! Here in programming, mod(%) gives the remainder after the division :)
+ 14
% means percentage on a calculator
+ 11
In calculator the % sign means percent, not modulus. Most calculators do not have the modulus implemented and those that do most often use "mod" as shortening.
+ 3
Nice question...I totally would not have realized this was confusing unless someone had asked.