Advertisement
Josif_tepe

Untitled

Jun 1st, 2021
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.61 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     int n;
  7.     cin >> n;
  8.     int niza[n];
  9.     for(int i = 0; i < n; i++) {
  10.         cin >> niza[i];
  11.     }
  12.     int paren_zbir = 0;
  13.     int neparen_zbir = 0;
  14.     for(int i = 0; i < n; i++) {
  15.         if(niza[i] % 2 == 0) {
  16.             paren_zbir += niza[i];
  17.         }
  18.         else {
  19.             neparen_zbir += niza[i];
  20.         }
  21.     }
  22.     if(paren_zbir > neparen_zbir) {
  23.         cout << "Pogolem e parniot zbir: " << paren_zbir << endl;
  24.     }
  25.     else {
  26.         cout << "Pogolem e neparniot zbir: " << neparen_zbir << endl;
  27.     }
  28.     return 0;
  29. }
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement