Advertisement
Mihai_Preda

Untitled

Nov 13th, 2020 (edited)
272
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. /**
  2.  * Copyright ITOIT Meditatii SRL
  3.  * Lesson challenge
  4.  */
  5. #include <iostream>
  6.  
  7. using namespace std;
  8.  
  9. // Descrieti in limbaj natural ce face programul de mai jos.
  10.  
  11. int main()
  12. {
  13.     int v[20], n, s = 0;
  14.     cin >> n;
  15.     for(int i = 0; i < n; ++i)
  16.         cin >> v[i];
  17.  
  18.     for(int i = 0; i < n; ++i)
  19.         if(v[i] % 2 == 0)
  20.             s += v[i];
  21.  
  22.     cout << s;
  23.     return 0;
  24. }
  25.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement