include vcl include iostream void main int mass_in int size_mass_in si

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <vcl.h>
#include <iostream.h>
void main()
{
int mass_in[] = {4, 8, 3, 2, 0 , 7, 9, 5, 5};
int size_mass_in = sizeof(mass_in)/sizeof(mass_in[0]);
int mass_out[9];
int size_mass_out = sizeof(mass_out)/sizeof(mass_out[0]);
int sum = 0;
for(int i = 0; (i < size_mass_out) && i < size_mass_in; i++)
{
mass_out[i] = mass_in[size_mass_in -i - 1];
if(mass_in[i] % 2 == 0)
{
sum += mass_in[i];
}
}
cout << "sum = " << sum << "\n";
cout << "mass_out = ";
for(int i = 0; i < 9; i++)
{
cout << mass_out[i];
}
cin.get();
}