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
help with loops and stuff
help with loops and stuff
Jan 31, 2013 at 3:41am
Jan 31, 2013 at 3:41am UTC
hotforwings
(1)
I am figuring out how to make my program display multiples of 3. would this code display multiples of 3?
1
2
3
4
5
while
(n > 0 || n % 3) { cout << n <<
", "
; --n; }
Jan 31, 2013 at 3:49am
Jan 31, 2013 at 3:49am UTC
LB
(13399)
No.
You could instead simply increment n by one each time and display n*3 ;)
Last edited on
Jan 31, 2013 at 3:50am
Jan 31, 2013 at 3:50am UTC
Topic archived. No new replies allowed.