Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int _array[5]={3,7,2,5,8} , _even[5] , _odd[5] , num=0 , num2=0;
- for(int i=0;i<5;i++)
- {
- if(_array[i]%2==0)
- {
- _even[num]=_array[i];
- num++;
- }
- else
- {
- _odd[num2]=_array[i];
- num2++;
- }
- }
- cout<<"even numbers\n";
- for(int j=0;j<5;j++)
- {
- cout<<_even[j]<<endl;
- }
- cout<<"\n\n\nodd numbers\n";
- for(int k=0;k<5;k++)
- {
- cout<<_odd[k]<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment