Announcement:

This is just the beginning of this blog, please don't copy any of my posts.

Thursday, 24 October 2013

[C Program] To Implement and Perform Various Operations on Symmetric Matrix.


//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. */
Share it Please

Pankaj Gaikar

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

Copyright @ 2013 Pune University Bachelor of Engineering . Designed by Pankaj Gaikar | Love for The Tricks Machine