Magic Square
Programming Assignment
A magic square is a square matrix (array) in which each row, column, and diagonal add up to the same value.
A magic square is a square matrix (array) in which each row, column, and diagonal add up to the same value.
For example,
For example,
Write a program which will read in a square matrix of any size and determine whether is is a "magic square." Your program should be efficient and flexible.
Write a program which will read in a square matrix of any size and determine whether is is a "magic square." Your program should be efficient and flexible.
Use the above matrix and at least one other (non-magic) matrix as data in the same computer run. Try this one for an "almost" magic square:
Use the above matrix and at least one other (non-magic) matrix as data in the same computer run. Try this one for an "almost" magic square:
Extra points: After you have the program working, re code it to use functions to sum across a single row and down a single column. You may wish to wait a couple of weeks for this.
Extra points: After you have the program working, re code it to use functions to sum across a single row and down a single column. You may wish to wait a couple of weeks for this.