I wrote the code but to get the output i need i changed it and cannot figure out how to put it in a nested loop. i know this code doesnt make sense. If anyone has any input or help I would greatly appreciate it. Thank you
Think of it like, for every row output a number for each column.
Since your output is dependent on the row and is the same for each column, use the row loop to change the output.
Your column loop is easy.
You just print an variable 6 times.
So you just make a for loop that does that and we will nest that loop inside the row loop.
1 2 3
for (int i = 0; i < 6; i++) {
cout << var << endl;
}
For the row loop, you want to run the column loop 4 times and change the variable to be printed out.
1 2 3 4 5 6 7 8
for (int j = 0; j < 4; j++) {
for (int i = 0; i < 6; i++) {
cout << var << endl;
}
//assuming you've defined a variable earlier in the code and it's set equal
//to the first value to be printed, decrement that variable now
var--;
}