Make a C program For centuries, only the most gifted magicians were able to tell whether a square is magic or not. But today, we are going to share this knowledge with the entire world! I need you to create a device capable of determining whether a square is magic or not. The thing is, a magic square is just a square matrix, whose size is odd and where the sum of the elements for each row and each column and each diagonal is same. Now go forth and unleash the truth! Input 1. N x N size of the square matrix Constraints The size is odd and > 0. 2. Elements of the square matrix Output The first line will contain a message prompt to input the size of the matrix. The succeeding lines will prompt for the elements of the matrix. The last line will contain the word "MAGIC!" if it is a magic square and "Just a square" if it isn't. Enter the size: 3 8 1 6 3 5 7 4 9 2 MAGIC!
Make a C program
For centuries, only the most gifted magicians were able to tell whether a square is magic or not. But today, we are going to share this knowledge with the entire world!
I need you to create a device capable of determining whether a square is magic or not. The thing is, a magic square is just a square matrix, whose size is odd and where the sum of the elements for each row and each column and each diagonal is same.
Now go forth and unleash the truth!
Input
1. N x N size of the square matrix
Constraints
The size is odd and > 0.
2. Elements of the square matrix
Output
The first line will contain a message prompt to input the size of the matrix.
The succeeding lines will prompt for the elements of the matrix.
The last line will contain the word "MAGIC!" if it is a magic square and "Just a square" if it isn't.
Enter the size: 3
8 1 6
3 5 7
4 9 2
MAGIC!
Step by step
Solved in 6 steps with 4 images