Advertisement
STANAANDREY

cnt neg poz

Dec 10th, 2019
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void SolvePB()
  5. {
  6.     int n, v[100], p = 0, ne = 0;
  7.     cin >> n;
  8.  
  9.     for  (int i = 0; i < n; i++)
  10.         cin >> v[i];
  11.  
  12.     for  (int i = 0; i < n; i++)
  13.         if (v[i] < 0)
  14.             ne++;
  15.         else
  16.             p++;
  17.  
  18.     cout << "pozitive:" << p << endl << "negative:" << ne;
  19. }
  20.  
  21. int main()
  22. {
  23.     SolvePB();
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement