Completely Solved C, C++ Programs Assignment.

 Quick Search Database Videos Tutorials Ebooks Forums FAQ Aboutus Household Industrial Manufacturing Service Shopping Transportation

### C Program to find whether a square matrix is a) symmetric b) skew symmetric c) none of two

 Filed Under: Sample C program

Problem 62. C Program to find whether a square matrix is a) symmetric b) skew symmetric c) none of two.
#include<stdio.h>
#include<conio.h>
main( )
{
int a[10][10],i,j,m,n,c=0,c1=0;
clrscr( );
printf(“enter the array size”);
scanf(“%d”,&n);
printf(“enter the elements”);
for(i=1;i<=m;i++)
for(j=1;j<=n;j++)scanf(“%d”,&a[i][j]);
for(i=1;i<=m;i++)
for(j=1;j<=n;j++)
{
if(a[i][j]==a[j][i])
c=1;
else
if(a[i][j]==a[j][i])
c1=1;
}
printf(“the given matrix is n”);
for(i=1;i<=m;i++)
{
for(j=1;j<=n;j++)
printf(“%4d”,a[i][j]);
printf(“n”);
}
if(c==0)
printf(“the given matrix is symmetric”);
else
if(c1==0)
printf(“the matrix is skew symmetric”);
else
printf(“none of two”);
}
getch( );
}

C compiler: gcc 4.1.2

Back to main directory: Sample C Program | Software Practical | Solved C Assignment