Advertisement
inhuman_Arif

Array 3

Sep 29th, 2021
941
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. typedef long long ll;
  5.  
  6. int main()
  7. {
  8.     #ifndef ONLINE_JUDGE
  9.         freopen("input.txt", "r", stdin);
  10.         freopen("output.txt", "w", stdout);
  11.     #endif
  12.  
  13.     int n;
  14.     cin >> n;
  15.     int arr[n];
  16.     for(int i=0;i<n;i++)
  17.         cin >> arr[i];
  18.     for(int i=0;i<n;i++)
  19.         if(arr[i]>=0)
  20.             cout << arr[i] << " ";
  21.     cout << endl;
  22.     cout << endl;
  23.     for(int i=0;i<n;i++)
  24.         if(arr[i]<0)
  25.             cout << arr[i] << " ";
  26.     cout << endl;
  27.    
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement