Răspuns:
#include <iostream>
using namespace std;
int main()
{
int n,i,a[101],aux;
cin>>n;
int imp=0;
int s=0;
int div=0;
int p=1;
for(i=1;i<=n;i++) {
cin>>a[i];
if(a[i]%2==1){
imp++;
}
if(a[i]%2==0 && i%2==1) s+=a[i];
if(a[i]%2==1)
{
aux=a[i];
a[i]=100;
100=aux;
}
if(a[i]%3==0 && a[i]%7==0) div++;
if(a[i]%3==0 && i%2==0) p*=a[i];
}
cout<<imp<<" "<<s<<" "<<div<<endl;
for(i=1;i<=n;i++) cout<<a[i]<<" ";
}
Explicație: