Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

can it be in programming language C, thanks A magic square is an arrangement of distinct integer numbers (i.e., each number is used once) from

image text in transcribed

can it be in programming language C, thanks

A magic square is an arrangement of distinct integer numbers (i.e., each number is used once) from 1 to N2 in an NxN square grid where the numbers in each row, and in each column, and the numbers in the main and secondary diagonals, all add up to the same number, which is N (N2+1) /2 For example, we can place the numbers from to 9-3 on a 3x3 MS with the same sum of 1S and place the numbers from 1 to 25-5 on a 5x5 MS with the same sum of 65, as shown in the below figures. 2 7 6 15 1-15 43815 16 23 6 19 2 15 4 12 25 8 16 10 18 1 14 22 11 24 7 20 3 17 5 13 21 9 15 A5 15 15 In the sample test, we were interested in checking if a given int MS [N ] [N] l/initial values , ...; is a valid Magic Square or not. Accordingly we implemented four functions. But this time, you will work on a different function that checks if the numbers in a given matrix are distinct (unique) numbers between 1 and N*N /suppose all standard C libraries are included here / define N 3 /+the number N can be large in an actual program int are all_numbers unique and in range(int MSI)N]) void main( int MSa [N] 2,,6), /for this, your function should return 1 (4,3, 8) int MSb [N] [N(2,6,6), for this, your Eunction should return 0 (4,6,10 it 4are-all-numbers_unique-and-in-rangel printf("YES, MSa and .) in all numbers are unique [1 fd] range ", N*N); printf("No, some numbers are not unique or in [1, %d] range ", N*N); NOW You are asked to implement the functions in the next page! *If all the numbers in MS are between [l, N N] and each one appears only once * then this function returns 1 * Otherwise, it returns o all numbers are unique) int are all numbers unique and in range (int MS[ (N]) int i, ji

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

Microsoft Visual Basic 2005 For Windows Mobile Web Office And Database Applications Comprehensive

Authors: Gary B. Shelly, Thomas J. Cashman, Corinne Hoisington

1st Edition

0619254823, 978-0619254827

More Books

Students also viewed these Databases questions

Question

Did the team members feel that their work mattered

Answered: 1 week ago

Question

2. What process will you put in place to address conflicts?

Answered: 1 week ago