#include<iostream> using namespace std; int main() { int A[5],B[5],C[5],b=0,c=0; cout<<"enter ur array please\n"; for(int a=0;a<5;a++) cin>>A[a]; for(int a=0;a<5;a++) if(A[a]%2==0) { B[b]=A[a]; b++; } else { C[c]=A[a]; c++; } cout<<"even items in array is\n"; for(int a=0;a<b;a++) cout<<B[a]<<"\t"; cout<<"\nodd items in array is\n"; for(int a=0;a<c;a++) cout<<C[a]<<"\t"; return 0; }
This post has been edited by jimblumberg: 20 April 2013 - 07:20 PM
Reason for edit:: Added missing code tags. Please learn to use them properly.