/* This program implements the binary search algorithm. */ #include int main( ) { int data[100]; int n, i, low, high, mid, found, key; do { printf("**** Enter the number of elements: "); scanf("%d", &n); } while (n<1 || n>100); for (i=0; ikey) high = mid -1; else low = mid + 1; } if (found) printf("Search succeeds. data[%d]=%d.\n", mid, data[mid]); else printf("Search fails. %d does not exist in the sequence.\n", key); system("pause"); return 0; }