Sorry to be wasting your time with this simple problem, but I'm in my first class and am stumped on a while loop.
Here is what I have:
Code:
#include <iostream>
int main() {
int i = 100;
while (i <= 150){
cout << i << " ";
i = i + 2;}
return 0;}
The program runs just fine, but the numbers all appear on one line. I need to have only 6 per line, for example 100 102 104 106 108 110
112 114 116 etc.... to 150
Keep in mind I have to use a while loop. I know I need to add another variable somewhere in that loop but I cant figure out the syntax I need to use. Can someone give me a push in the right direction? Thank you very much.