2、i==8
完整的程序:
#include <stdio.h>
void main()
{
int a[9]={1,2,3,4,5,6,7,8},i,x;
scanf("%d",&x);
a[8]=x;i=0;
while(a[i]!=x) i++;
if(i==8)
printf("no found");
else
printf("found");
}
找不到的情況:
9
no foundPress any key to continue
找得到的情況:
6
foundPress any key to continue