Given an array of 15 integers filled with random numbers from 30 to 90 Calculate the number of array
June 3, 2021 | education
| Given an array of 15 integers filled with random numbers from 30 to 90 Calculate the number of array elements that are divisible by 2.
#include <iostream>
#include <ctime>
using namespace std;
void main ()
{
setlocale (LC_ALL, “rus”);
srand (time (0));
int const N = 15;
int mas [N], num = 0;
cout << “Array elements:” << endl;
for (int i = 0; i <N; i ++)
{
mas [i] = rand ()% 60 + 30;
cout << mas [i] << “”;
if (mas [i]% 2 == 0)
{
num ++;
}
}
cout << endl << “The number of items to be divisible by two:” << num << endl;
system (“pause”);
}
One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.