-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path18thmay.c
39 lines (37 loc) · 868 Bytes
/
18thmay.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include<stdio.h>
int main()
{
int r,c;
printf("Enter the size of the matrix: ");
scanf("%d %d",&r,&c);
if(r!=c)
printf("The given matrix is not a square matrix and hence symmetry cannot be determined\n");
else
{
int matrix[r][c];
int i,j,status=1;
printf("Enter the matrix\n");
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
scanf("%d",&matrix[i][j]);
}
}
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
if (matrix[i][j]!=matrix[j][i])
{
status=0;
}
}
}
if(status==1)
printf("The given matrix is symmetric\n");
else
printf("The given matrix is not symmetric\n");
}
return 0;
}