Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int i, j;
- const int n = 5;
- int a[n][n];
- for (i = 0; i < n; i++)
- {
- for (j = 0; j < n; j++)
- cin >> a[i][j];
- cout << endl;
- }
- bool q;
- q = true;
- for (i = 0; i < n && q; i++)
- {
- for (j = i + 1; j < n; j++)
- if (a[i][j] != a[j][i])
- q = false;
- }
- if (q) cout << "symmetrical";
- bool b = true;
- for (i = 0; i < n && b; i++)
- {
- for (j = 0; j < n; j++)
- if (a[i][j] != 0 && i > j)
- b = false;
- }
- bool t = true;
- for (i = 0; i < n && t; i++)
- {
- for (j = 0; j < n; j++)
- if (a[i][j] != 0 && i < j)
- t = false;
- }
- if (b) cout << "nijnaya treugolnaya";
- if (t) cout << "verhnya treugolnaya";
- bool c=true;
- for (i = 0; i < n&&c; i++)
- {
- for (j = 0; j < n; j++)
- if (a[i][j] == 0 && (i == j) && (j - i == 1 || i - j == 1))
- c = false;
- }
- if (c)
- cout << "trehdiagonalnaya";
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment