mirandaflu / spiral-printer

Prints numbers from 0 up to a given integer in a spiral

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Goal:

Write some code that accepts an integer and prints the integers from 0 to that input integer in a spiral format.

For example, if I supplied 24 the output would be:

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

Notes:

  • Implemented in JavaScript
  • Takes integer input through a form
  • Prints output to a <pre> element
  • Watch the spiral grow outward: press "Start Printing Test"
  • Enter a negative integer and the spiral goes in the opposite direction

About

Prints numbers from 0 up to a given integer in a spiral


Languages

Language:JavaScript 93.4%Language:CSS 6.6%