diff --git a/BINARYSE.CPP b/BINARYSE.CPP new file mode 100644 index 0000000..64ed875 --- /dev/null +++ b/BINARYSE.CPP @@ -0,0 +1,42 @@ +#include +#include +void main() +{ clrscr(); + int n,item,a[21], flag=1,first,last,middle; + cout<<"\nEnter no.of elements:"; + cin>>n; + cout<<"\nEnter the elements:"; + for(int i=0;i>a[i]; + } + cout<<"\nenter element to be searched:"; + cin>>item; + first=0; + last=n-1; + middle=(first+last)/2; + while(first<=last) + { + if(a[middle] +#include +void main() +{ + clrscr(); + int a[11],n,i,k,flag=0; + cout<<"\nEnter the no.of elements:"; + cin>>n; + cout<<"\nEnter the elements:"; + for(i=0;i>a[i]; + } + cout<<"\nEnter the element to be searched:"; + cin>>k; + for(i=0;i