help with loops and stuff

Jan 31, 2013 at 3:41am
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
No.

You could instead simply increment n by one each time and display n*3 ;)
Last edited on Jan 31, 2013 at 3:50am
Topic archived. No new replies allowed.