+ 1
Modulus [C++]
I am confused. How do I use the modulus operator to get remainders and decimals?
2 Answers
+ 1
int a=25;
int p=a%10;
double b = a/10;
// p=5 b=2.5
+ 1
See my "% Modulus explained" code to understand in a way, you may have learnt at school
https://code.sololearn.com/c2fRl6x893E7/?ref=app