Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <time.h> // для подключения функции time()
- using namespace std;
- int main() {
- setlocale(LC_ALL, "ru");
- const int row = 3;
- const int col = 4;
- int arr[row][col];
- srand(time(NULL));
- for (int i = 0; i < row; i++) {
- for (int j = 0; j < col; j++) {
- arr[i][j] = rand() % 5;
- cout << arr[i][j] << "\t";
- }
- cout << endl;
- }
- int count = 0;
- for (int i = 0; i < row; i++) {
- for (int j = 0; j < col; j++) {
- if (arr[i][j] == 0) {
- count++;
- }
- }
- }
- cout << count << endl;
- }
Add Comment
Please, Sign In to add comment