#include <stdio.h>
int temp, array[6], n,odd=0,even=0, num_odd[6], num_even[6];
printf("Enter numbers\t: ");
for(n=0;n<6; n++)
scanf("%d", &array[n]);
for(n=0; n<6; n++){
temp=array[n]%2;
if(temp==0){
num_even[even]=array[n];
even++;}
if(temp==1){
num_odd[odd]=array[n];
odd++;}
}
printf("\nEven numbers\t: ");
for(n=0; n<even;n++){
printf("%2d", num_even[n]);
}
printf("\n");
printf("\nOdd numbers\t: ");
for(n=0; n<odd;n++){
printf("%2d", num_odd[n]);
}
printf("\n\n");
system ("pause");
return 0;
}
No comments:
Post a Comment