Friday, 20 January 2012

C program to check whether a matrix is symmetric(ENIGMA) or not.......


#include<iostream.h>
#include<conio.h>
#include<process.h>
void main()
{
int mat[100][100];
clrscr();
int m,n,i,j;
cout<<"ENTER THE ROW N COLUMN VALUE\n";
cin>>m>>n;
cout<<"ENTER THE ELEMENTS ONE BY ONE\n";
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cin>>mat[i][j];

}
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
cout<<"\t"<<mat[i][j]<<"\t";
}
cout<<"\n";
}
for(i=0;i<=m-2;i++)
{
for(j=i+1;j<=n-1;j++)
{
if(mat[i][j]!=mat[j][i])
{
cout<<"NOT ENIGMA\n";
}

else
{
cout<<
"ITS ENIGMA";
}
}
}

getch();
}

No comments:

Post a Comment