diff --git a/Sorting and searching/Binary_search.C b/Sorting and searching/Binary_search.C new file mode 100644 index 0000000..178a8b7 --- /dev/null +++ b/Sorting and searching/Binary_search.C @@ -0,0 +1,36 @@ +#include +int main() +{ int a[10], num,i , n, pos=-1, beg, end, mid, found=0; + printf("Enter The Number Of Elements of the Array\n"); + scanf("%d",&n); + printf("Enter The Elements\n"); + for(i=0;inum) + { end=mid-1; + } + else + beg=mid+1; + + + } + + if(found==1) + { printf("Value Found at %d position\n",pos+1); + } + else + printf("VALUE NOT FOUND !\n"); + +return 0;}