Here are some magic squares:
4 9 2 3 5 7 8 1 6 7 12 1 14 2 13 8 11 16 3 10 5 9 6 15 4
Input:
From the command line, a number N which is the size of the square.
Output:
To the console, a grid like shown above with the number arranged in a magic square.
Language:
C# preferred, but if you need to exercise your skills in another language, feel free to post.
For initial entries you only need to support odd values for N, just print out an message saying that you don't support even sizes. For those who want to be challenged support powers of 2 for N. For bragging rights, support all even numbers.
Be sure to post your code within spoiler tags to keep this challenge fresh for everyone.
This post has been edited by Skydiver: 29 September 2012 - 03:22 PM

New Topic/Question
Reply


MultiQuote




|