Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 03 / solutions / exercise 10.cpp
blob: dae43ab0606bd18194ad163f4ae4e63702541e74 (plain) (blame)
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
#include <iostream>

using namespace std;

int main()
{
	int count;
	cin >> count;

	for (int i = 1; i <= count; i++)
	{
		for (int j = 0; j < count; j++)
		{
			if (j % 2 == 0)
			{
				cout << i + (count * j) << " ";
			}
			else
			{
				cout << (j + 1) * count - (i - 1) << " ";
			}
		}
		cout << endl;
	}
}