% invalid operand | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

% invalid operand

The modulus operator (%) is informally known as the remainder operator because it returns the remainder after an integer division. But when I write the code #include <iostream> using namespace std; int main() { int x = 100.25 + 60.25-40.25*10.25/5.25 % 11.25; cout << x; return 0; } when we click run button; output as below: ..\Playground\: In function 'int main()': ..\Playground\:6:46: error: invalid operands of types 'double' and 'double' to binary 'operator%' int x = 100.25 + 60.25-40.25*10.25/5.25 % 11.25;

15th Sep 2018, 1:50 AM
kp kalia
kp kalia - avatar
1 Answer
+ 6
You just said it there: "For integer division." You were operating with floating-point values.
15th Sep 2018, 1:50 AM
Hatsy Rei
Hatsy Rei - avatar