//C语言实现
#include<stdio.h>
int main()
{
int a[1000];
int b[1000];
int n;
int i,j=0;
printf("Please input the number of the array:\n");
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
for(i=0;i<n;i++)
if(a[i]%2)
b[j++]=a[i];
for(i=0;i<n;i++)
if(a[i]%2==0)
b[j++]=a[i];
for(i=0;i<n;i++)
printf("%d ",b[i]);
}
温馨提示:答案为网友推荐,仅供参考