Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream> //
- using namespace std;
- int main(){
- int n;
- cin>>n;
- int a[n];
- int b[n];
- int pi=0;
- int ni=0;
- int x;
- for(int i=0; i<n; i++){
- cin>>x;
- if(x%2==0){
- a[pi]=x;
- pi+=1;
- }
- if(x%2!=0){
- b[ni]=x;
- ni+=1;
- }
- }
- for(int i=0; i<pi; i++){
- cout<<a[i]<<" ";
- }
- cout<<endl;
- for(int i=0; i<ni; i++){
- cout<<b[i]<<" ";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment