From 33299860d6325a9052c074533c4d071fdeefbcd2 Mon Sep 17 00:00:00 2001 From: WongChinWee <93850449+WongChinWee@users.noreply.github.com> Date: Mon, 30 May 2022 20:08:53 +0800 Subject: [PATCH] Update exercise5.c --- exercise5.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) 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