Computer Science, asked by noelRohith38651, 1 year ago

C program to find whether the given matrix is identity or not

Answers

Answered by piyushatre29
2

#include<stdio.h>

#include<conio.h>

void main()

{

clrscr();

int a[3][3], identity;

printf("\nEnter the matrix");

for(int i=0;i<3;i++)

{

for(int j=0;j<3:j++)

scanf("%d",&a[i][j]);

}

identitiy=1;

for(int i=0;i<3;i++)

{

for(j=0;j<3;j++)

{

if(i==j && A[i][j]!=1)

{

identity=0;

}

else if(i!=j && a[i][j]!=0)

{

identity=0;

}

}

}

if(identity==1)

{

printf("\n The given matrix is a identity matrix");

for(int i=0;i<3;i++)

{

for(int j=0;j<3:j++)

{

printf("%d",a[i][j]);

}

printf("\n");

}

else

printf("\n This matrix is not the identity matrix");

getch();

}

i hope it will help u

can u please mark it as brainleist it takes me about 10min to type and check it's working... :-)

please its my kind rqst..

Answered by punithgunda55
0

Explanation:

its help to my study to the computer science

assignments

Similar questions