// 从键盘输入3个0~9的数字,然后输出0~9中哪些数字没有出现过
#include <stdio.h>
int main(int argc, const char *argv[]){
int a[10] = {0};
int i = 0, j = 0;
int num;
for (; i < 3; i++){
printf("请输入第%d个数: ", i+1);
scanf("%d", &num);
a[num] = 1;
}
for(; j < 10; j++){
if (a[j] != 1){
printf("%d ", j);
}
}
printf("\n");
return 0;
}
时间: 2024-12-17 13:20:55