### Making loop with skipping an argument

Hello. I need some help with making loops. I'm just starting with programming. Let's say I have a code like that

 ``123456789101112`` `````` #include using namespace std; main () { int n; for (n=-4; n<15; n=n+3) { cout<

or

 ``12345678910111213`` ``````#include using namespace std; main() { int n=-4; while (n<15) { cout<

From both codes I get numbers

 `-4, -1, 2, 5, 8, 11, 14`

First of all, I need a code that would skip the numbers 2 and 8. I have no idea how to do it.

Secondly, how to make a loop which will show the amount of numbers depending on how much I want? Not until the condition/expression will be false. For example I want to see 10 numbers straight.
Question
Why skip 2 and 8, how must the sequence of the numbers be?

as for the amount of numbers depending on how many you want there is lots of ways to do that

1. asking the user how many then using that number
2. using an infinite loop and pausing the number shown for some seconds to so the numbers won't fill up the whole screen and give you a chance to break out when once you have all the digits needed.
 I need a code that would skip the numbers 2 and 8.
 ``1234567891011`` ``````for (n=-4; n<15; n=n+3) { if (n == 2 || n == 8) continue; cout<
 I want to see 10 numbers straight.
 ``1234567`` ``````int n = -4; int printed = 0; while(printed < 10) { std::cout << n; ++printed; n +=3; }``````
Thank you both, finally I can continue my work on studying C++ :)
Topic archived. No new replies allowed.