-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSymmetricMatrix.cpp
More file actions
46 lines (46 loc) · 889 Bytes
/
Copy pathSymmetricMatrix.cpp
File metadata and controls
46 lines (46 loc) · 889 Bytes
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
40
41
42
43
44
45
46
#include<iostream>
using namespace std;
int main()
{
int a[10][10], b[10][10];
int i,j,n,count=0;
cout<<"Enter the order of square matrix: "<<endl;
cin>>n;
cout<<"Enter the elements of the matrix: "<<endl;
for(i=0; i<n; i++)
{
for(j=0; j<n; j++)
{
cin>>a[i][j];
}
}
cout<<"The matrix is: \n";
for(i=0; i<n; i++)
{
for(j=0; j<n; j++)
{
cout<<a[i][j]<<"\t";
}
cout<<"\n";
}
for(i=0; i<n; i++)
{
for(j=0; j<n; j++)
{
b[j][i]=a[i][j];
}
}
for(i=0; i<n; i++)
{
for(j=0; j<n; j++)
{
if(a[i][j]==b[i][j]);
count++;
}
}
if(count==n*n)
cout<<"Matrix is symmetrical"<<endl;
else
cout<<"Matrix is not symmetrical"<<endl;
return 0;
}