Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- const int rows = 3;
- const int cols = 4;
- int A[rows][cols];
- cout << "Введите элементы массива 3x4:" << endl;
- for (int i = 0; i < rows; i++) {
- for (int j = 0; j < cols; j++) {
- cin >> A[i][j];
- }
- }
- int count = 0;
- for (int i = 0; i < rows; i++) {
- for (int j = 0; j < cols; j++) {
- if (A[i][j] % 4 == 2) {
- count++;
- }
- }
- }
- cout << "Количество элементов, которые при делении на 4 дают остаток 2: " << count << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement