Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int MAX = 10;
- void symmetry(int a[][MAX], int n) {
- bool isSymmetric = true;
- for(int i=0; i<n; i++) {
- for(int j=0; j<n; j++) {
- if(a[i][j] != a[j][i]) {
- isSymmetric = false;
- break;
- }
- }
- if(!isSymmetric) break;
- }
- if(isSymmetric) cout << "YES";
- else cout << "NO";
- }
- int main() {
- int n, a[MAX][MAX];
- for(int i=0; i<MAX; i++) {
- for(int j=0; j<MAX; j++) {
- cin >> a[i][j];
- }
- }
- for(int i=0; i<MAX; i++) {
- for(int j=0; j<MAX; j++) {
- cout << a[i][j] << " ";
- }
- cout << endl;
- }
- cout << endl;
- cin >> n;
- for(int i=0; i<n; i++) {
- for(int j=0; j<n; j++) {
- cout << a[i][j] << " ";
- }
- cout << endl;
- }
- symmetry(a, n);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment