//Program for symmetric matrix.
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10][10],i,j,m,n,flag=0;
clrscr();
printf("Enter the order for square matrix:");
scanf("%d %d",&m,&n);
printf("\n\nEnter the elements into matrix:\n");
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
scanf("%d",&a[i][j]);
}
}
for(i=0;i<m;i++)
{
for(j=0;j<n;j++)
{
if(a[i][j]==a[j][i])
continue;
else
{
flag=1;
goto xyz;
}
}
}
xyz:
if(flag==0)
printf("\nMatrix is Symmetric.");
else
printf("\nMatrix is not symmetric.");
getch();
}
/*Output of Program
Enter the order for square matrix:3 3
Enter the elements into matrix:
1 2 3
2 7 0
3 0 3
Matrix is Symmetric. */
Pankaj Gaikar is a
professional blogger
from Pune, India who writes on Technology, Android,
Gadgets, social media and latest tech updates at
Punk Tech
,
Being Android
&
Shake The Tech
. Email me
HERE
0 comments :
Post a Comment