Website Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commita2988f74c6cace502805e2e124e23ca2b95bb335 (patch)
Author
 Angel Dimitriev <achi_d@abv.bg>
2021-10-28 17:50:26 +0300
Committer
 GitHub <noreply@github.com>
2021-10-28 17:50:26 +0300
Files3528fa5bfaead3dfcfba383d9f569c62700bcd14
Introduction_to_programming_FMI-a2988f74c6cace502805e2e124e23ca2b95bb335.tar
Introduction_to_programming_FMI-a2988f74c6cace502805e2e124e23ca2b95bb335.tar.gz
Introduction_to_programming_FMI-a2988f74c6cace502805e2e124e23ca2b95bb335.zip
Parent2b10276d97ac8b019814cb8049a2364d9668aa4e (diff)
Parenta94b6226e75e809d35bafa7a30bdbf988ed3a052 (diff)
Merge pull request #9 from Tony5768/patch-4
Create example 11 - reverse numbers by row
1 files changed, 28 insertions, 0 deletions
-rw-r--r--Sem. 03/example 11 - reverse numbers by row28
diff --git a/Sem. 03/example 11 - reverse numbers by row b/Sem. 03/example 11 - reverse numbers by row
new file mode 100644
index 0000000..66a90a9
--- /dev/null
+++ b/Sem. 03/example 11 - reverse numbers by row
@@ -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;
+ }
+}