#include<stdio.h>//header file
#include<conio.h>//header file
void main() //starting of the main() function
{
int a[5][5],flag=0,i,j,m; //declaration of the variables
clrscr();
printf("program that checks whether a given matrix is symmetric or not");
printf("\n\nthe first condition for a symmetric matrix is,it should be a square matrix");
printf("\n\n\n\t\t------------INPUT-------------");
printf("\n\nenter a no. for rows and columns of the matrix");
scanf("%d",&m); //taking input from the user
printf("\nenter the elements in the matrix");
for(i=0;i<m;i++)
{
for(j=0;j<m;j++)
{
printf("\na[%d][%d] :->",i,j);
scanf("%d",&a[i][j]);
}
}
for(i=0;i<m;i++)
{
for(j=0;j<m;j++)
{
if(a[j][i]!=a[i][j])
{
printf("\n\n\n\t\t------------OUTPUT------------");
printf("\n\nthe matrix is not symmetric");//printing output
getch();
exit(0);
}
}
}
printf("\n\n\n\t\t------------OUTPUT------------");
printf("\n\nit is a symmetric matrix");//printing output
getch();
}