From a78a314b374e5372c3865f16bde40845db5b79a2 Mon Sep 17 00:00:00 2001 From: Angel Dimitriev Date: Thu, 28 Oct 2021 10:51:13 -0400 Subject: Create exercise 10.cpp --- Sem. 03/solutions/exercise 10.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Sem. 03/solutions/exercise 10.cpp (limited to 'Sem. 03/solutions/exercise 10.cpp') diff --git a/Sem. 03/solutions/exercise 10.cpp b/Sem. 03/solutions/exercise 10.cpp new file mode 100644 index 0000000..dae43ab --- /dev/null +++ b/Sem. 03/solutions/exercise 10.cpp @@ -0,0 +1,25 @@ +#include + +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; + } +} -- cgit v1.3.1-23-gd82d