Skip to content
Home » Binary Search | Logical Programming in C | by Mr.Srinivas naresh i technology c language

Binary Search | Logical Programming in C | by Mr.Srinivas naresh i technology c language



Binary Search | Logical Programming in C | by Mr.Srinivas ** For Online Training Registration: ▻ Call: +91-8179191999 Subscribe to our …

Images related to the topic naresh i technology c language

Binary Search | Logical Programming in C | by Mr.Srinivas

Binary Search | Logical Programming in C | by Mr.Srinivas

Search related to the topic Binary Search | Logical Programming in C | by Mr.Srinivas

#Binary #Search #Logical #Programming #MrSrinivas
Binary Search | Logical Programming in C | by Mr.Srinivas
naresh i technology c language
See all the latest ways to make money online: See more here
See all the latest ways to make money online: See more here

See also  G-Technology 4TB G-DRIVE USB 3.0 Desktop External Hard Drive - 0G03594 g technology g drive setup

28 thoughts on “Binary Search | Logical Programming in C | by Mr.Srinivas naresh i technology c language”

  1. #include <stdio.h>

    int main()
    {
    int arr[20],key=61,low,high,mid,n,found=0;
    printf("enter the size of array: ");
    scanf("%d",&n);
    printf("enter elements into array");
    for(int i=0;i<n;i++)
    {
    scanf("%d",&arr[i]);
    }
    low=0;
    high=n-1;
    mid=(low+high)/2;
    while(low<=high)
    {
    if(key<arr[mid])
    {
    high=mid-1;
    }
    else if(key>arr[mid])
    {
    low=mid+1;
    }
    else if(key==arr[mid])
    {
    printf("element found @ loc %dn",mid);
    found=1;
    break;
    }
    }

    return 0;
    }

Leave a Reply

Your email address will not be published.