hello guys . the code is doin well
enter sorted integers and num to be searched
the problem is in the last if condition
#include<iostream.h>
#include<conio.h>
#define siz 10
void main()
{
int arra[siz]={0};
int mid,beg=1,end=siz,loca=0,num;
clrscr();
cout<<"Please Enter The Elements Of Array\n";
for(loca=0;loca<siz;loca++)
{
cin>>arra[loca];
}
cout<<"Please enter the required number";
cin>>num;
mid=(loca)/2;
while(beg<end&&arra[mid]!=num)
{
if(num<arra[mid])
end=mid-1;
else
beg=mid+1;
mid=(beg+end)/2;
}
if (arra[mid]!=num)
cout<<"\nnot found";
else if (arra[mid]==num)
cout<<"location is\t"<<mid;
getch();
}