0

what are modulus?

3rd Dec 2016, 2:44 PM
Aravind.Arun.m
Aravind.Arun.m - avatar
2 odpowiedzi
+ 1
the modulus ( %) is an operator that returns the remainder of a division . example : 7%5== 2 . 2 is the remainder .
3rd Dec 2016, 2:58 PM
Bahhaⵣ
Bahhaⵣ - avatar
+ 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 !
3rd Dec 2016, 3:36 PM
Ash Ketchum
Ash Ketchum - avatar