Program to check whether given matrix is symmetric or not
#include < stdio.h>
#include < conio.h>
main()
{
int a[9][9],r,i,j,n=0;
clrscr();
printf("Enter the order of the matrix:");
scanf("%d",&r);
printf("Enter the Matrix\n");
for(i=0;i < r;i++)
{
for(j=0;j < r;j++)
{
scanf("%d",&a[i][j]);
}
}
for(i=0;i < r;i++)
{
for(j=0;j < r;j++)
{
if(a[i][j]!=a[j][i])
n=1;
}}
if(n==1)
printf("\n\nUnsymmetric");
else
printf("\n\nSymmetric");
getch();
}
0 comments:
Post a Comment