I want to use a for loop with variable step size, in particular I want that the i
variable in for
loop is equal to:
- All numbers except the ones which can be divided by
3
so:
i = 1-2-4-5-7-8-10-11-13-14-16-17…
- All numbers except the ones which can be divided by
3
and2
so:
i = 1-5-7-11-13-17…
The base code:
#include <iostream>
int main()
{
int N = 100;
for ( int i=0; i<N; i++) { //<-----
//instructions
}
return 0;
}
Is it possible with for
loop?
Best Answer