Question: A Lo Shu Magic Square is a grid with three rows and three columns that has two properties 1. Each of the elements of the

 A Lo Shu Magic Square is a grid with three rows

A Lo Shu Magic Square is a grid with three rows and three columns that has two properties 1. Each of the elements of the grid contains an integer from 1 through 9, with no number repeated. 2. The sum of each row, column, and diagonal add up to 15. 276 4 3 8 Write a program that validates that a square is "magic" using a two-dimensional 3 x3 array. It should have a bool function named isMagicSquare which accepts the array as an argument and returns true if it is a Lo Shu Magic Square and false otherwise. It should test all of the requirements above. Test your program with four arrays 1. one (such as the one above) which is a magic square. 2. one in which all rows, columns, and diagonals add to 15, but has digits which repeat. 3. one with a digit that is not between 1 and 9 4. one which uses unique numbers from 1 to 9, but which doesn't satisfy the 2nd requirement above

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!