KINDLY READ THE QUESTION CAREFULLY AND DON'T USE ANY SQUARE BRACKETS IN YOUR CODE . AND OUTPUT MUST MATCH AS IT IS . ----------------------------- Write a program to find the type of square matrix using functions.   a) Function - findSymmetric which returns 1 if the matrix is symmetric and 0 if the matrix is not symmetric. If the transpose of a matrix is equal to itself, that matrix is said to be symmetric. b) Function - findIdentity which returns 1 if the matrix is an identity matrix and 0 if the matrix is not an identity matrix. An Identity matrix is a square matrix in which 1s on the main diagonal, and 0s everywhere else. c) Function - findMagic which returns 1 if the matrix is a magic square and 0 if the matrix is not a magic square. A Magic Square is a square matrix in which the sum of the elements in each row and column is the same. Note: Use dynamic allocation of memory. (i.e use malloc()). Use functions for reading and displaying a matrix and to find the matrix types. Function specification: int ** readMatrix(int rows, int cols) void displayMatrix(int** a,int rows, int cols) int findSymmetric(int ** a, int n). int findIdentity(int ** a, int n) int findMagic(int ** a, int n) Input Format: Input consists of (n*n)+1 integers. The first integer corresponds to n, the number of rows/columns in the matrix. The next 'n' integers correspond to the elements in the first row of the matrix. The next 'n' integers correspond to the elements in the second row of the matrix and so on.   Output Format: Refer to Sample Output for formatting details.   [All text in bold corresponds to input and the rest corresponds to output.] Sample Input and Output 1: Enter the number of rows and columns in the matrix 3 Enter the elements in the matrix 1 0 0 0 1 0 0 0 1 The given matrix is 1 0 0 0 1 0 0 0 1 Matrix is Symmetric Matrix is Identity Matrix is Magic     Sample Input and Output 2: Enter the number of rows and columns in the matrix 3 Enter the elements in the matrix 23 45 23 13 34 56 78 45 34 The given matrix is 23 45 23 13 34 56 78 45 34 Matrix is not Symmetric Matrix is not Identity Matrix is not Magic       Problem Requirements: C Keyword Min Count Max Count ] 0 0 Keyword Min Count Max Count [ 0 0 Function Definitions: int ** readMatrix (int , int)  void displayMatrix (int **, int, int)  int findSymmetric (int **, int)  int findIdentity (int **,int)  int findMagic (int **, int)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Question
100%

KINDLY READ THE QUESTION CAREFULLY AND DON'T USE ANY SQUARE BRACKETS IN YOUR CODE . AND OUTPUT MUST MATCH AS IT IS .

-----------------------------

Write a program to find the type of square matrix using functions.

 

a) Function - findSymmetric which returns 1 if the matrix is symmetric and 0 if the matrix is not symmetric. If the transpose of a matrix is equal to itself, that matrix is said to be symmetric.

b) Function - findIdentity which returns 1 if the matrix is an identity matrix and 0 if the matrix is not an identity matrix. An Identity matrix is a square matrix in which 1s on the main diagonal, and 0s everywhere else.

c) Function - findMagic which returns 1 if the matrix is a magic square and 0 if the matrix is not a magic square. A Magic Square is a square matrix in which the sum of the elements in each row and column is the same.

Note:

Use dynamic allocation of memory. (i.e use malloc()).

Use functions for reading and displaying a matrix and to find the matrix types.


Function specification:

int ** readMatrix(int rows, int cols)
void displayMatrix(int** a,int rows, int cols)
int findSymmetric(int ** a, int n).
int findIdentity(int ** a, int n)
int findMagic(int ** a, int n)


Input Format:

Input consists of (n*n)+1 integers.

The first integer corresponds to n, the number of rows/columns in the matrix.

The next 'n' integers correspond to the elements in the first row of the matrix.

The next 'n' integers correspond to the elements in the second row of the matrix and so on.

 

Output Format:

Refer to Sample Output for formatting details.

 

[All text in bold corresponds to input and the rest corresponds to output.]

Sample Input and Output 1:

Enter the number of rows and columns in the matrix

3

Enter the elements in the matrix

1 0 0

0 1 0

0 0 1

The given matrix is

1 0 0

0 1 0

0 0 1

Matrix is Symmetric

Matrix is Identity

Matrix is Magic
 

 

Sample Input and Output 2:

Enter the number of rows and columns in the matrix

3

Enter the elements in the matrix

23 45 23

13 34 56

78 45 34

The given matrix is

23 45 23

13 34 56

78 45 34

Matrix is not Symmetric

Matrix is not Identity

Matrix is not Magic
 

 

 

Problem Requirements:

C

Keyword Min Count Max Count
] 0 0
Keyword Min Count Max Count
[ 0 0



Function Definitions:

int ** readMatrix (int , int) 
void displayMatrix (int **, int, int) 
int findSymmetric (int **, int) 
int findIdentity (int **,int) 
int findMagic (int **, int) 
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 5 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education