Website Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commitc132894e81e29e4c6c6dfa3a2ea70aea95860955 (patch)
Author
 Angel Dimitriev <achi_d@abv.bg>
2021-10-28 10:52:11 -0400
Committer
 GitHub <noreply@github.com>
2021-10-28 10:52:11 -0400
Files534a93f0e491902a0e52d906a687454c2525e081
Introduction_to_programming_FMI-c132894e81e29e4c6c6dfa3a2ea70aea95860955.tar
Introduction_to_programming_FMI-c132894e81e29e4c6c6dfa3a2ea70aea95860955.tar.gz
Introduction_to_programming_FMI-c132894e81e29e4c6c6dfa3a2ea70aea95860955.zip
Parent4e4a0a5458c2e9b015d37956f10fe67f00c05285 (diff)
Create exercise 11.cpp
1 files changed, 28 insertions, 0 deletions
-rw-r--r--Sem. 03/solutions/exercise 11.cpp28
diff --git a/Sem. 03/solutions/exercise 11.cpp b/Sem. 03/solutions/exercise 11.cpp
new file mode 100644
index 0000000..66a90a9
--- /dev/null
+++ b/Sem. 03/solutions/exercise 11.cpp
@@ -0,0 +1,28 @@
+#include <iostream>
+
+using namespace std;
+
+int main()
+{
+ int count;
+ cin >> count;
+
+ for (int i = 1; i <= count; i++)
+ {
+ if (i % 2 != 0)
+ {
+ for (int j = 1 + ((i - 1) * count); j <= i * count; j++)
+ {
+ cout << j << " ";
+ }
+ }
+ else
+ {
+ for (int j = i * count; j > (i - 1) * count; j--)
+ {
+ cout << j << " ";
+ }
+ }
+ cout << endl;
+ }
+}