+ 3

What is the function of % in C++?

18th Jan 2017, 8:10 PM
tayyab
2 Answers
+ 1
yes, it will provide the remainder. try int division For fun.... ..(123 % 10 = 3) // you know what what's in ones position. ..(123 / 10 % 10 = 2 ) // ... now tens position ..(123 / 10 / 10 % 10 = 1 ) // .... now hundreds Position
2nd Feb 2017, 6:26 AM
JofS
JofS - avatar
0
it divides a number by another number and returns the leftover. For instance: int Hello = 10%3; the value of our variable Hello is 1, because 3*3=9, but 1 can't be divided by 3 so our leftover is 1 :) hope thuis helped!
18th Jan 2017, 8:30 PM
kj loosman
kj loosman - avatar