Advertisement
evage

Untitled

Oct 13th, 2021
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. using namespace std;
  4.  
  5. int main() {
  6.     int n;
  7.     cout << "Enter count of numbers\n";
  8.     cin >> n;
  9.     vector<int> a(n);
  10.     cout << "Enter numbers\n";
  11.     for (int i = 0; i < n; ++i)
  12.         cin >> a[i];
  13.     int s = 0, cnt = 0;
  14.     for (int i = 0; i < n; ++i)
  15.     {
  16.         if (a[i] % 2 != 0)
  17.             s += a[i];
  18.         if (a[i] > 25)
  19.             ++cnt;
  20.     }
  21.     cout << "sum = " << s << endl;
  22.     cout << "count = " << cnt << endl;
  23.  
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement