From 79b645b1007568b3322e94d6723d5ee32ef18bf3 Mon Sep 17 00:00:00 2001 From: WongChinWee <93850449+WongChinWee@users.noreply.github.com> Date: Mon, 30 May 2022 19:55:45 +0800 Subject: [PATCH] Update exercise5.c //documentation section /* Exercise 5 - Binary Search* by Wong Chin Wee/ //pre-processor section #include //global variable section //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 --- exercise5.c | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/exercise5.c b/exercise5.c index f865f0a..e3a76b8 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