diff --git a/exercise5.c b/exercise5.c index f865f0a..a4261ab 100644 --- a/exercise5.c +++ b/exercise5.c @@ -1,5 +1,5 @@ //documentation section -/* Exercise 5 - Binary Search*/ +/* Exercise 5 - Binary Search by Wong Chin Wee */ //pre-processor section #include @@ -10,8 +10,35 @@ //main function section int main(){ //write here your program - + int n,i,a,low,high,mid; + printf("Enter the number of elements: "); + scanf("%d",&n); + int array[n]; + printf("Enter the elements in a sorted manner:\n"); + for(i=0;ihigh) + printf("%d is not present in the array.",a); + return 0; } -//user-defined section +//user-defined section