• Дан двумерный массив 6 на 4. Пощетать количество элементов во всем массиве которые кратны 3.

Ответы 1

  • #include <iostream>using std::cout;using std::endl;using std::left;#include <cstdlib>using std::rand;using std::srand;#include <ctime>using std::time;#include <iomanip>using std::setw;int main(){    int a[6][4];    int counter = 0;    srand(time(0));    for(int i = 0; i < 6; i++)    {        for(int j = 0; j < 4; j++)        {            a[i][j] = rand() % 20 + 1;            if(a[i][j] % 3 == 0)            {                counter++;            }            cout << setw(2) << left << a[i][j] << ' ';        }        cout << endl;    }    cout << '' << counter << " elements" << endl;   return 0;}

    answer img
    • Автор:

      babs35vr
    • 7 лет назад
    • 0
  • Добавить свой ответ

Еще вопросы

Войти через Google

или

Забыли пароль?

У меня нет аккаунта, я хочу Зарегистрироваться

How much to ban the user?
1 hour 1 day 100 years