+ 3
What is the function of % in C++?
2 Respuestas
+ 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
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!