/*This program uses binary search to find givven number from the givven sorted array written by Sadi Evren SEKER*/ #include #define m 10 /*--- m is a constant and can be changed for different problems---*/ int search(int i); /*--- decleration of my searc function ---*/ int a[m]={-3,4,8,12,54,55,62,70,73,95}; /*--- initial array for search function it can be changed for other problems ---*/ void main() { int i; printf("You can search one of the following numbers , is seperator\n\n"); for (i=0;i"); /*--- inputs shoise ---*/ scanf("%d",&i); if (search(i)==0) /*--- if not found print error 404 is code from html browsers ---*/ printf("\n\nError 404 object not found\n"); else /*--- if found print the order of number ---*/ printf("\n\nYour number is found at %d. order\n",search(i)); } int search(int i) /*--- this function gets an integer and uses binary search on it to find on initial array and turns its order as integer ---*/ { int tavan,taban,cur; tavan=m; taban=0; cur=m/2; while((tavan-taban!=1)&&(tavan!=taban)) /* if ceil=flor not found */ { if (a[0]==i) /*--- becouse it always rounds 1 higher value */ return 1; if (a[cur]==i) /*--- if it is our number return it --*/ return cur+1; if(a[cur]>i) /*--- if our number is smaller */ { tavan=cur; /*---get ceil down */ cur=(tavan+taban)/2; /*--- find new current value at middle */ } else if(a[cur]