#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 << '\n' << counter << " elements" << endl; return 0;}
#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 << '\n' << counter << " elements" << endl;
return 0;
}