Lo Shu Magic Square Quiz using C:
Lo Shu Magic Square is a 3x3 grid that contains the following properties:
- the numbers 1-9
- none of the numbers repeat
- the sum of each column, row, and diagonal equals 15
Functions:
- Generate a random 3x3 square without repeated numbers
- Test if the square is magic
- Print out the square in the following format:
[ 1 2 3 ]
[ 4 5 6 ]
[ 7 8 9 ] - Continuously generate till a magic square is found. Output:
Attempt: 43890
Magic square found!
[ 4 9 2 ]
[ 3 5 7 ]
[ 8 1 6 ]
Note: If you want to test the other functions by themselves, I recommend uncommenting some of the test cases under main in magicMain.c
