+ 3
What is modulus and how does it work in C++?
What is modulus and how does it work in C++? How to calculate it and what is the utility?
2 Answers
+ 5
Modulus operator is not limited to C++ only.
But here is how it works:
You know that 27=6*4+3
Hence, 3 the remainder when 27 is divided by 6.
Hence, 27%6=3.
+ 1
This code will help you to fully understed how modulus works:
https://code.sololearn.com/Wcy7iV5Ln1ly/?ref=app