Posts
 
Reputation
Joined
Last Seen
0 Reputation Points
Unknown Quality Score

No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.

0 Endorsements
Ranked #107.55K
~176 People Reached
Favorite Forums
Favorite Tags
c++ x 1

1 Posted Topic

Member Avatar for amarie

/*BINARY SEARCH PROGRAM BY SUMAIR IRSHAD*/ #include<stdio.h> #include<conio.h> void main(void) { clrscr(); int arr[]={1,3,5,7,9,11,13,15,17,19}; int i,target,start=0,end=10,mid; printf("enter target"); scanf("%d",&target); while(target!=arr[mid]) { mid=(start+end)/2; if(target==arr[mid]) { break; } else if(target<arr[mid]) { end=mid-1; } else if(target>arr[mid]) { start=mid+1; } } printf("target found at %dth location",mid+1); getch(); }

Member Avatar for Freaky_Chris
0
176

The End.