#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
setlocale(LC_ALL, "RUS");
int num;
const int size = 10;
int a[size];
srand(time(NULL));
cout << "Массив:\n";
for (int i = 0; i < size; i++) {
cout << (a[i] = rand() % 10) << " ";
}
cout << "\nчетные:\n";
for (int i = 0; i < size; i++)
if (a[i] % 2 == 0 )
cout << a[i] << " ";
num = a[0];
cout << endl;
cout << "\nПолученный массив\n";
if (a[i] % 2 == 0)
a[i] = a[i] + num;
system("pause");
return 0;
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main()
{
setlocale(LC_ALL, "RUS");
int num;
const int size = 10;
int a[size];
srand(time(NULL));
cout << "Массив:\n";
for (int i = 0; i < size; i++) {
cout << (a[i] = rand() % 10) << " ";
}
cout << "\nчетные:\n";
for (int i = 0; i < size; i++)
{
if (a[i] % 2 == 0 )
{
cout << a[i] << " ";
num = a[0];
}
}
cout << endl;
cout << "\nПолученный массив\n";
for (int i = 0; i < size; i++)
{
if (a[i] % 2 == 0)
a[i] = a[i] + num;
cout << a[i] << " ";
}
cout << endl;
system("pause");
return 0;
}