0
what are modulus?
2 odpowiedzi
+ 1
the modulus ( %) is an operator that returns the remainder of a division .
example : 7%5== 2 . 2 is the remainder .
+ 1
Pretty much what bahhax404 said, it's the remainder from division, here's an example.
int a = 10;
int b = 3;
sum = 10%3;
cout << "The remainder of this is:" << endl << sum;
Output:
The remainder of this is:
1
3 goes into 10 3 times before it becomes a decimal. So, since it went in 3 times that's 9, and 10 - 9 = 1.
Hope this helped !