Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //arry problem 3
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n;
- cin >> n;
- int arr[n];
- vector<int> v, v1;
- for(int i = 0; i < n; i++)
- {
- cin >> arr[i];
- if(arr[i] < 0)
- v1.push_back(arr[i]);
- else
- v.push_back(arr[i]);
- }
- cout << "Positive vales are > ";
- for(int i=0; i<=v.size()-1; i++)
- cout << v[i] << " ";
- cout << endl;
- cout << "negative vales are > ";
- for(int i=0; i<=v1.size()-1; i++)
- cout << v1[i] << " ";
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement