What do this operator? ( % ) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What do this operator? ( % )

29th Aug 2017, 7:23 PM
WaitProgrammer
3 Answers
+ 3
It is the modulus (pronounced as mo-du-lo) operator. As others have told, it tells you the remainder. And do remember that it works only with int data type in cpp.
30th Aug 2017, 3:07 AM
Harsh Kumar
Harsh Kumar - avatar
+ 2
It is the modulo operator. It returns the REMAINDER after a division operation.
29th Aug 2017, 7:29 PM
AgentSmith
+ 2
for example, 5%2 would be 1.
29th Aug 2017, 10:08 PM
hamletmun
hamletmun - avatar