cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
user name:
password:
Forgot your password?
please wait
try again
cancel
forgot your password?
sign up
log in
[Legacy version]
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
Use of "%" operator in this way.
Use of "%" operator in this way.
Dec 30, 2012 at 1:50am
Dec 30, 2012 at 1:50am UTC
Xecutive
(3)
I need a little help in understanding this, if someone could.
1
2
if
((iii % 3)==0)
continue
;
I was told that if iii was divisible by 3 the if statement would return true.
I don't understand what the % dose in the equation.
Last edited on
Dec 30, 2012 at 1:54am
Dec 30, 2012 at 1:54am UTC
Dec 30, 2012 at 2:03am
Dec 30, 2012 at 2:03am UTC
closed account (
zb0S216C
)
It's the modulus operator: its job is to divide the left operand by the right operand and then return the remainder. For example, 7 % 3 is 1 because 3 goes into 7 twice but the 1 is left over.
Wazzak
Last edited on
Dec 30, 2012 at 2:04am
Dec 30, 2012 at 2:04am UTC
Topic archived. No new replies allowed.