编写一个程序实现以下内容

img

#include <stdio.h>

int main()
{
    int x, y;
    scanf("%d", &x);
    if (x < 1)
    {
        y = x;
    }
    else if (x < 10)
    {
        y = 2 * x - 5;
    }
    else
    {
        y = 3 * x - 11;
    }
    printf("%d \n", y);
    return 0;
}
#include <stdio.h>
int main()
{
    double x;
    scanf("%lf",&x);
    if(x < 1)
        y =x;
    else if(x>=1 && x<10)
        y = 2*x -5;
    else
        y = 3*x -11;
    printf("%g",y);
    return 0;
}