int last =n-1
int middle,index;
index=-1;
while(first<=last)/2
if(【?】)
{
index=middle
break;
}
else if(【?】)
last=middle-1;
else
first=middle+1;
}
return index;
}
# include
voide main (void)
{
int x [ ]={-1,0,1,3,5,7,9}
int n =sizeof (x)/sizeof(int);
int answer ,i;
printf("\nldex search prgram");
printf("\n==========");
printf('\n\nGiven Array")
for(i=0;i
【?】;
if(answer>=0)
printf("\n\nYES.X[%d]=%d has been found",answer,answer);
else
printf("\n\nNo,there is no element with x[i]=i");
}