ChloeLiang / spiral-ascension

[quick]

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Spiral-Ascension

https://media.giphy.com/media/JN7rcwL4B9cDm/giphy.gif

Write a function that takes a number as a parameter. Make a spiral that begins with 1 and starts from the top left, going towards the right, and ends with the square of that number.

Input: 5

Output:

 1  2  3  4 5
16 17 18 19 6
15 24 25 20 7
14 23 22 21 8
13 12 11 10 9

Input:4

Output:

 1  2  3  4 
12 13 14  5
11 16 15  6
10  9  8  7

further:

Take a parameter and make a clockwise or counter-clockwise spiral.

further:

Make a pyramid instead of a square shape.

About

[quick]