Advertisement
Rehan_Rahman26

//arry problem 3

Sep 30th, 2021
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.60 KB | None | 0 0
  1. //arry problem 3
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4. int main()
  5. {
  6.  
  7.     int n;
  8.     cin >> n;
  9.     int arr[n];
  10.     vector<int> v, v1;
  11.     for(int i = 0; i < n; i++)
  12.     {
  13.         cin >> arr[i];
  14.         if(arr[i] < 0)
  15.             v1.push_back(arr[i]);
  16.         else
  17.             v.push_back(arr[i]);
  18.     }
  19.  
  20.     cout << "Positive vales are > ";
  21.     for(int i=0; i<=v.size()-1; i++)
  22.         cout << v[i] << " ";
  23.         cout << endl;
  24.  
  25.     cout << "negative vales are > ";
  26.  
  27.     for(int i=0; i<=v1.size()-1; i++)
  28.         cout << v1[i] << " ";
  29.         cout <<  endl;
  30.  
  31.     return 0;
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement