C Program to implement Binary Search...


int binarysearch(int a[],int n,int key)
 int beg,end,mid;
 return mid;
 else if(key>a[mid])
 return -1;

void main()
 int a[100],n,i,key;
int pos;
 printf("Enter the no of elements of the Array..");
 printf("\nEnter the elements one by one in ascending order..");
 printf("\nEnter the element to search..");
  printf("\nThe element is not found..");
  printf("\nThe element is found in the position is %d",pos);

No comments:

Post a Comment