+ 2
What does % as math operator in C++?
Example: a = 16 % 3;
2 Respostas
+ 10
% 👈🏻 this is a modulus operator and we use this operator for getting the remainder when we divide two numbers
When 16 gets divided by 3 we get quotient 5 and remainder as : 1
So when we print : cout<< 16%3;
We get 1 (which is a remainder) as output
+ 2
Hi! The operator of the remainder of the number %
(for example: 17 % 3 = 2)
1. Take the nearest number when divided by 3 would be zero. That's apparently 15
2. Subtract 15 from 17 and the result is your answer.