Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int n;
- cin>>n;
- int a[n+2];
- int odd[n+2];
- int eve[n+2];
- int idx1=0, idx2=0;
- for(int i=0;i<n;i++){
- cin>>a[i];
- if(a[i]%2==0){
- eve[idx1]=a[i];
- idx1++;
- }
- else{
- odd[idx2]=a[i];
- idx2++;
- }
- }
- for(int i=0;i<idx1;i++){
- cout<<eve[i]<<" ";
- }
- cout<<endl;
- for(int i=0;i<idx2;i++){
- cout<<odd[i]<<" ";
- }
- cout<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement