Write a C program to search for a book based on the ISBN whether the book is present or not (Binary Search).

#include < stdio.h>
void main()
{
int a[30],i,num,key,low,mid,high;
printf("\n enter the no of elements");
scanf("%d",&n);
printf("\n enter the elements : ");
for(i=0;i < n;i++)
{
scanf("%d", &a[i]);
}
printf("\n enter the key element to be searched\n");
scanf("%d", &key);
low=0;
high=n-1;
while(low <= high)
{
mid=(low+high)/2;
if(a[mid]==key)
{
printf("element %d is found at %d position :",key,mid+1);
exit(0);
}
else if (a[mid] > key)
high = mid-1;
else low = mid+1;
}
printf("element not found\n");
}