一个C语言程序题,中间的那个请说明怎么做
给了一个已经赋值的数组,先由小到大排序,再把其中相同的数字删除后输出,最后用函数把其中的偶数和奇数分别输出
用数轴做 最简单
程序代码:
#include <stdio.h>
#define LEN 10
int main(int argc, char* argv[]) {
int a[LEN] = {0, 0, 1, 1, 1, 2, 2, 2, 2, 3};
int b[LEN] = {0}, i = 0, j = 0, *p = b;
while(i < LEN) {
*p++ = a[i];
j = i;
while(j++ < LEN) {
if(a[j] != a[i]) {
i = j;
break;
}
}
}
for(i = 0; i < (p - b); i++) {
printf("%d ", b[i]);
}
puts("");
return 0;
}
