Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 03 / Solutions / 10. Spiral_Numbers.cpp
diff options
context:
space:
mode:
Commitf51185d90bfe76d1fef272fe449c1d3d3bb89528 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2021-11-03 21:15:51 +0200
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2021-11-03 21:15:51 +0200
Files4c291c81d43cf6305cd22777bc33efc6b580c4ad /Sem. 03/Solutions/10. Spiral_Numbers.cpp
Introduction_to_programming_FMI-sem03-solutions.tar
Introduction_to_programming_FMI-sem03-solutions.tar.gz
Introduction_to_programming_FMI-sem03-solutions.zip
Parent72eb06dcc769114c7dbdcf7092e218b58d2196bf (diff)
Made some minor formatting and style changes to improve readability sem03-solutions
1 files changed, 3 insertions, 1 deletions
-rw-r--r--Sem. 03/Solutions/10. Spiral_Numbers.cpp4
diff --git a/Sem. 03/Solutions/10. Spiral_Numbers.cpp b/Sem. 03/Solutions/10. Spiral_Numbers.cpp
index 66e5e70..15ab136 100644
--- a/Sem. 03/Solutions/10. Spiral_Numbers.cpp
+++ b/Sem. 03/Solutions/10. Spiral_Numbers.cpp
@@ -10,6 +10,7 @@ int main()
for (int row = 0; row < n; row++)
{
int previous = row + 1;
+
for (int col = 0; col < n; col++)
{
if (col == 0)
@@ -17,8 +18,9 @@ int main()
else if (col % 2 == 0)
cout << (previous += row * 2 + 1) << " ";
else
- cout << (previous += (n -row -1) * 2 + 1) << " ";
+ cout << (previous += (n - row - 1) * 2 + 1) << " ";
}
+
cout << endl;
}
}