Website Summary Files Commits Branches @commit @diff @stats
path: root / Sem. 03 / Solutions / 10. Spiral_Numbers.cpp
diff options
context:
space:
mode:
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;
}
}