fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main(){
  4. long int n;
  5. long int sum=0;
  6. vector<long int>v(n);
  7. for(int i=0;i<n;i++)
  8. cin>>v[i];
  9. for(int i=0;i<n;i++){
  10. if(v[i]%2==1)
  11. sum+=v[i];
  12. }
  13. cout<<sum<<"\n";
  14. return 0;
  15. }
Success #stdin #stdout 0.01s 5268KB
stdin
5
6 9 8 4 3
stdout
0