C++ Programming Code Examples C++ > Arrays and Matrices Code Examples C++ Program to Find Even and Odd Elements in Array C++ Program to Find Even and Odd Elements in Array For Separate Even and Odd Elements of Array we take three array and one array for insert all Array Elements second for even elements and third for odd elements. We check condition for odd and even Elements arr[]%2==0. #include<iostream.h> #include<conio.h> void main() { int arr[20],even[20],odd[20],x,j=0,k=0,no; clrscr(); cout<<"How Size of Array: "; cin>>no; cout<<"Enter any "<<no<<" elements in Array: "; for(x=0; x<no;x++) { cin>>arr[x]; } for(x=0; x<no;x++) { if(arr[x]%2==0) { even[j]=arr[x]; j++; } else { odd[k]=arr[x]; k++; } } cout<<"\nEven Elements: "; for(x=0; x<j ;x++) { cout<<even[x]<<" "; } cout<<"\nOdd Elements: "; for(x=0; x<k; x++) { cout<<odd[x]<<" "; } getch(); }