Advertisement
a53

pv

a53
Jan 24th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. int n;
  7. cin>>n;
  8. int a[n+1];
  9. for(int i=1;i<=n;++i)
  10. cin>>a[i];
  11. int svp=0,svpp=0,nnd10=0,snd3pi=0;
  12. for(int i=n;i;--i)
  13. {
  14. if(a[i]%2==0)
  15. svp+=a[i];
  16. if(i%2==0)
  17. svpp+=a[i];
  18. if(a[i]%10==0)
  19. ++nnd10;
  20. if(a[i]%3==0&&i%2)
  21. snd3pi+=a[i];
  22. cout<<a[i]<<' ';
  23. }
  24. cout<<'\n'<<svp<<'\n'<<svpp<<'\n'<<nnd10<<'\n'<<snd3pi<<'\n';
  25.  
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement