diff --git a/binary using method.cpp b/binary using method.cpp new file mode 100644 index 0000000..1ab7ff3 --- /dev/null +++ b/binary using method.cpp @@ -0,0 +1,50 @@ +#include + +using namespace std; + +int main() +{ + int search(int [],int,int); + int n,i,a[100],e,res; + cout<<"How Many Elements:"; + cin>>n; + cout<<"\nEnter Elements of Array in Ascending order\n"; + + for(i=0;i>a[i]; + } + + cout<<"\nEnter element to search:"; + cin>>e; + + res=search(a,n,e); + + if(res!=-1) + cout<<"\nElement found at position "<a[m]) + f=m+1; + else + l=m-1; + } + + return -1; +} \ No newline at end of file