DevJourney · code I wrote while learning

Identitiy Matrix

2 items

README.md

Single File Programming Question

Problem Statement

In a mathematics class, students are learning about identity matrices and their properties. To reinforce their understanding, they are tasked with developing a program that checks whether a given matrix is an identity matrix or not using pointers.

Write a program to assist the students.

Input format :

The first line of input consists of two integers, n and m representing the order of the matrix.

The following lines consist of the matrix elements.

Output format :

The output prints whether the given matrix is an identity matrix or not.

Refer to the sample output for formatting specifications.

Code constraints :

1 ≤ m, n ≤ 10

Sample test cases :

Input 1 :

3 3 1 0 0 0 1 0 0 0 1

Output 1 :

Identity matrix

Input 2 :

3 3 1 0 0 1 0 1 0 1 0

Output 2 :

Not an identity matrix