1)
#include
#include
#include
using namespace std;
const int size = 10;
int main()
{
srand (time(0));
int a[size];
int k1 = 0,k2 = 0;
for (int i=0; i {
a[i]=rand()%20-10;
cout <<a[i] <' ';<br> k1+=(a[i]>0 && a[i]%2) ? a[i]:0;
k2+=(a[i]<0 && !(a[i]%2)) ? 1:0;<br> }
cout <<k1 <<end <<k2 <<endl;<br> return 0;
}
2)
#include
#include
#include
using namespace std;
const int size = 10;
int main()
{
srand (time(0));
int a[size];
int k1 = 0,k2 = 0;
for (int i=0; i {
a[i]=rand()%20-10;
cout <<a[i] <' ';<br> k1+=(a[i]<0 && !(i%2)) ? 1:0;<br> k2+=(a[i]>0 && !(a[i]%2) && i%2) ? a[i]:0;
}
cout <<k2 <<end <<k2 <<endl;<br> return 0;
}