From b83b99d995793c7a88b7f8ecc8512d5f48b01338 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Fri, 29 Oct 2021 09:30:23 +0300 Subject: Fixed name and missing spaces between keyword and bracket on exercise 11 --- Sem. 03/Solutions/11. Spiral_Numbers_2.cpp | 26 ++++++++++++++++++++++++++ Sem. 03/Solutions/11.Spiral_Numbers_2.cpp | 26 -------------------------- 2 files changed, 26 insertions(+), 26 deletions(-) create mode 100644 Sem. 03/Solutions/11. Spiral_Numbers_2.cpp delete mode 100644 Sem. 03/Solutions/11.Spiral_Numbers_2.cpp diff --git a/Sem. 03/Solutions/11. Spiral_Numbers_2.cpp b/Sem. 03/Solutions/11. Spiral_Numbers_2.cpp new file mode 100644 index 0000000..f6bc2d4 --- /dev/null +++ b/Sem. 03/Solutions/11. Spiral_Numbers_2.cpp @@ -0,0 +1,26 @@ +#include + +using namespace std; + +int main() +{ + int n; + cin >> n; + + for (int i = 0, previous = 0; i < n; i++) + { + int modifier = 1; + if (i % 2 == 1) + { + previous += n + 1; + modifier = -1; + } + + for (int j = 0; j < n; j++) + cout << (previous += modifier) << " "; + + cout << endl; + if (i % 2 == 1) + previous += n - 1; + } +} diff --git a/Sem. 03/Solutions/11.Spiral_Numbers_2.cpp b/Sem. 03/Solutions/11.Spiral_Numbers_2.cpp deleted file mode 100644 index 3ff0f16..0000000 --- a/Sem. 03/Solutions/11.Spiral_Numbers_2.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include - -using namespace std; - -int main() -{ - int n; - cin >> n; - - for(int i = 0, previous = 0; i < n; i++) - { - int modifier = 1; - if (i % 2 == 1) - { - previous += n + 1; - modifier = -1; - } - - for(int j = 0; j < n; j++) - cout << (previous += modifier) << " "; - - cout << endl; - if (i % 2 == 1) - previous += n - 1; - } -} -- cgit v1.3.1-23-gd82d