diff --git a/binarysearch.cpp b/binarysearch.cpp new file mode 100644 index 0000000..06000bd --- /dev/null +++ b/binarysearch.cpp @@ -0,0 +1,33 @@ +#include +#include +int main() +{ +int i,n; +cout<<"Enter size of array: "; +cin>>n; +int a[n]; +cout<<"Enter array: "; +for (i=0;i>a[i]; +int beg=0,end=n-1; +int no; +cout<<"Enter no to be searched: "; +cin>>no; +int mid=(beg+end)/2; +while(beg<=end) +{ + if(a[mid]end) +cout<<"Not found"; +return 0; +} \ No newline at end of file