+ 1

What is Modulas operator? In C++? HELP Please!

23rd Sep 2017, 8:07 AM
[No Name]
2 Answers
+ 14
modulus( %) is a mathematical operator that returns the remainder after a division. for example; 5modulus 3 or just 5%3 is equal to 2. that is what remains after you divide 5 by three. other examples include; 3%2=1; 7%4=3; 15%7=1; 9%3=0;
23rd Sep 2017, 8:16 AM
P R
P R - avatar
+ 11
In C++, the modulus operator (%) returns the remainder after an integer division. As if you divide 25 by 7 i.e. 25%7 you're going to get the remainder as 4 (working : 7*3 = 21, 25-21 = 4). Note : Your multiplication should not exceed the dividend - 25!
23rd Sep 2017, 8:20 AM
Dev
Dev - avatar