/****************************************
* Program to Chech Wheather *
* a matrix is Symmetric or *
* Not *
****************************************/
#include
#include
void main()
{
int i,j,row,col,ele[10][10],ele2[10][10],val=0;
clrscr();
printf("enter the size of a square matrix**>");
scanf("%d%d",&row,&col);
printf("enter %d Elements",row*col);
for(i=0;i
{
for(j=0;j
{
scanf("%d",&ele[i][j]);
}
printf("\n");
}
for(i=0;i
{
for(j=0;j
{
ele2[j][i]=ele[i][j];
}
}
for(i=0;i
{
for(j=0;j
{
if(ele[i][j]==ele[j][i])
{
val++;
}
else
{
val=0;
break;
}
}
}
for(i=0;i
{
for(j=0;j
{
printf("\t%d",ele[i][j]);
}
printf("\n");
}
if(val==(row*col))
{
printf("It's a symmetric matrix");
}
else
{
printf("It's not a symmetric matrix");
}
getch();
}|
|
|
|
|
#include
void main()
{
int i,j,row,col,ele[10][10],ele2[10][10],val=0;
clrscr();
printf("enter the size of a square matrix**>");
scanf("%d%d",&row,&col);
printf("enter %d Elements",row*col);
for(i=0;i
{
for(j=0;j
{
scanf("%d",&ele[i][j]);
}
printf("\n");
}
for(i=0;i
{
for(j=0;j
{
ele2[j][i]=ele[i][j];
}
}
for(i=0;i
{
for(j=0;j
{
if(ele[i][j]==ele[j][i])
{
val++;
}
else
{
val=0;
break;
}
}
}
for(i=0;i
{
for(j=0;j
{
printf("\t%d",ele[i][j]);
}
printf("\n");
}
if(val==(row*col))
{
printf("It's a symmetric matrix");
}
else
{
printf("It's not a symmetric matrix");
}
getch();
}
No comments:
Post a Comment