Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Make a program in c++ that complies with the following instructions. You are very fond of riddles and in particular you are fascinated by the

Make a program in c++ that complies with the following instructions.

You are very fond of riddles and in particular you are fascinated by the topic of magic squares. A magic square is a matrix of NN numbers that has the property that the sum of the elements of each row, each column and both diagonals are worth the same. Even if building a magic square can get a bit complicated, you think you can write a program to tell you whether or not a square matrix is a magic square.

Entry: An integer N followed by NN integers y representing the elements of an array given square from top to bottom and left to right. You can assume that 1 N 100.

Exit: A 1 if the given matrix is a magic square and a 0 otherwise.

Example:

-Entry. 4 1 14 14 4 11 7 6 9 8 10 10 5 13 2 3 15 -Exit. 1

-Entry. 3 1 0 0 0 0 1 1 0 0 -Exit. 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

If possible, shake hands.

Answered: 1 week ago

Question

Are robots going to displace all workers? Explain your answer.

Answered: 1 week ago