The loop is to print all the even numbers from 100-200, with 10 per line. Currently it is printing in a triangle formation. I am unsure how to limit the number per line to 10, if anyone could help I would greatly appreciate it.
1 2 3 4 5 6 7 8
int num1;
int num2;
for (num1 = 100; num1 < 200; num1 += 2) {
for (num2 = 100; num2 <= num1; num2 += 2)
cout << num2;
cout << "\n";
}
You really don't need two loops to do what you want, and it seems simple and practical just to use a separate counter (y) to keep track of when to do the new-line, although I'm sure there are many other ways too.