+ 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

1st May 2017, 4:43 PM
Waqas Ahmed
Waqas Ahmed - avatar
4 Answers
+ 28
@Waqas Kuba is right! Here in programming, mod(%) gives the remainder after the division :)
1st May 2017, 4:50 PM
Dev
Dev - avatar
+ 14
% means percentage on a calculator
1st May 2017, 4:51 PM
Hukilaura
Hukilaura - avatar
+ 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.
1st May 2017, 4:48 PM
Kuba SiekierzyƄski
Kuba SiekierzyƄski - avatar
+ 3
Nice question...I totally would not have realized this was confusing unless someone had asked.
6th Jun 2017, 5:13 PM
Kirk Schafer
Kirk Schafer - avatar