Around We Go (POTW)

From http://cemc.uwaterloo.ca/resources/potw/2012-13/POTWE-12-AE-NP-28-P.pdf, used with permission.

"A spiral of numbers is created, as shown. starting with 1. If the pattern of the spiral continues, how will the numbers 399, 400 and 401 appear in the spiral? (Will they appear left to right in a row? right to left in a row? down in a column? up in a column? down and then left? or up and then right?)"

Assignment: Write a program that prompts for a number and determines if it appears at the beginning (and therefore also the end) of a line of numbers, or in the middle? If in the middle, is the number in a line where the numbers appear left to right in a row, right to left in a row, down in a column, or up in a column?