#include <stdio.h>

int main()
{
    int data[5] = {2, 3, 7, 8, 9};
    int nums[3] = {5, 7, 9};
    int low, high, mid;
    low = 0;
    int found = 0;

    for (int i = 0; i < 3; i++)
    {
        int num = nums[i];
        high = 4;
        while (low <= high)
        {
            mid = (low + high) / 2;
            if (num == data[mid])
            {
                printf("Yes ");
                found = 1;
                break;
            }

            else if (num > data[mid])
            {
                low = mid + 1;
            }
            else if (num < data[mid])
            {
                high = mid - 1;
            }
            
        }
        if (found == 0)
            {
                printf("No ");
            } 
    }

    return 0;
}

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: