Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void input(int a[4][4])
- {
- cout << "Input array:" << endl;
- for (int i = 0; i < 4; i++)
- {
- for (int j = 0; j < 4; j++)
- {
- cout << "a[" << i << "][" << j << "]=";
- cin >> a[i][j];
- }
- }
- }
- void diagcheck(int a[4][4])
- {
- int countcheck = 0;
- for (int i = 0; i < 4; i++)
- {
- for (int j = 0; j < 4; j++)
- {
- if (i==j)
- {
- if (a[i][j] != 0)
- {
- countcheck++;
- }
- }
- }
- }
- if (countcheck != 0)
- {
- cout << "Ima elementi ot glavniq diagonal, koito ne sa ravni na nula!" << endl;
- }
- else
- {
- cout << "Vsichki elementi ot glavniq diagonal sa ravni na nula!" << endl;
- }
- }
- void main()
- {
- int a[4][4];
- input(a);
- diagcheck(a);
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement