Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- const int SIZE = 4;
- int main() {
- int arr[][SIZE]{
- {0, 3, 9, 5},
- {1, 3, 4, 65},
- {1, 32, 4, 0},
- {7, 0, 4, 5},
- {0, 3, 4, 5},
- {1, 3, 4, 5},
- {-7, -1, 4, 5},
- {0, 3, 0, 5},
- {1, 1, -5, 5},
- {4, 4, 4, 5},
- {0, 3, 4, 0}
- };
- //array output
- for (auto &i: arr) {
- for (int j: i)
- cout << " " << j;
- cout << endl;
- }
- cout << endl;
- int numberOfZeros = 0;
- for (int i = 0; i < sizeof(arr) / (SIZE * sizeof(int)); i++) {
- for (int j = 0; j < SIZE; j++) {
- if (arr[i][j] == 0) {
- cout << i + 1 << " - " << j + 1 << ", ";
- numberOfZeros++;
- }
- }
- }
- cout << endl << "number of zeros: " << numberOfZeros;
- }
Advertisement
Add Comment
Please, Sign In to add comment