Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int a[4][4] =
- {
- { 1,0,0,0 },
- { 1,0,0,0 },
- { 2,3,0,0 },
- { 3,0,1,0 },
- };
- int n = 4;
- bool b = true;
- bool q = false;
- for (int i = 0; i < n && b; i++)
- {
- for (int j = i + 1; j < n && b; j++)
- {
- if (a[i][j] != 0)
- b = false;
- }
- }
- if (b) {
- for (int i = 0; i < n; i++)
- {
- for (int j = 0; j <= i; j++)
- {
- if (a[i][j] != 0)
- {
- q = true;
- }
- }
- }
- }
- if (b && q) cout << "treugolnaya";
- else cout << "ne treugolnaya ";
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment