displaying a pattern of numbers

I can't figure out what I need to do to display these numbers in the correct order


//Displays the following pattern of numbers
//2 4 6
//8 10 12
//14 16 18
//20 22 24

#include <iostream>

using std::cout;
using std::cin;
using std::endl;

int main()
{
int number = 0;

for (int outer = 1; outer < 4; outer = outer + 1)
for (int inner = 1; inner < 5; inner = inner + 1)
{
number = number + 2;
cout << number << endl;
}
cout << endl;

return 0;
}
Replace the first endl with a whitespace character ( ' ' )
Add braces to include cout << endl; in the outer loop
Please use [code][/code] tags
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//Displays the following pattern of numbers
//2 4 6
//8 10 12
//14 16 18
//20 22 24


#include <iostream>

using std::cout;
using std::cin;
using std::endl;

int main()
{
	int number = 0;

	for (int outer = 0; outer < 3; outer = outer + 1)
	{
		for (int inner = 1; inner < 5; inner = inner + 1)
		{
			number = number + 2;
			cout << number << ' ';
		}	
		cout << endl;
		}
	return 0;
}   


It's getting close, but I need it to display the numbers exactly how the comments say
your inner loop should print one line text of text. There are three numbers per line, so it should loop 3 times.
your outer loop controls the number of lines of text to output. There are 4 lines, so it should loop 4 times.
hahaha crap. I didn't even look at the loop condition. I knew this all along. Thanks guys!
Topic archived. No new replies allowed.