69,371
社区成员
发帖
与我相关
我的任务
分享
1 #include <stdio.h>
2 main(){
3 int array[10];
4 long temp;
5 int i,j;
6 printf("input ten numbers(between -32768 and +32767):\n");
7 for(i=0;i <10;i++){
8 scanf("%Ld",&temp);
9 if(temp <-32768 || temp>32767){
10 i--;
11 printf("number must between -32768 and +32767\ntry again:\n");
12 continue;
13 }else{
14 array[i]=(int)temp;
15 }
16 }
17 printf("your numbers:\n");
18 for(j=0;j <10;j++){
19 printf(" %d ",array[j]);
20 }
21
22 printf("\ngod bye\n");
23 }