Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //pv #2858
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, a[101];
- cin>>n;
- for (int i=1; i<=n; i++)
- cin>>a[i];
- int sum_pare=0, sum_poz_pare=0, nr_div_10=0, sum_poz_imp_div_3=0;
- for (int i=1; i<=n; i++)
- {
- if (a[i]%2==0)
- sum_pare+=a[i];
- if (i%2==0)
- sum_poz_pare+=a[i];
- if (a[i]%10==0)
- nr_div_10++;
- if (i%2==1 && a[i]%3==0)
- sum_poz_imp_div_3+=a[i];
- }
- for (int i=n; i>=1; --i)
- cout<<a[i]<<' ';
- cout<<endl;
- cout<<sum_pare<<endl;
- cout<<sum_poz_pare<<endl;
- cout<<nr_div_10<<endl;
- cout<<sum_poz_imp_div_3<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement