编辑代码

#include <stdio.h>
int Search(int nums[], int key, int n)
{
    int low = 1, high = n - 1;
    while (low <= high)
    {
        int m = (low + high) / 2;
        if (key == nums[m])
            return m + 1;
        else if (key > nums[m])
            high = m - 1;
        else
            low = m + 1;
    }
    return 0;
}



int main()
{
    int nums[]={85, 63, 52, 34, 25, 17, 6};
    printf("%d",Search(nums,6,7));
    
}