int x = 0;
int y = 0;
printf("请输入x的值");
scanf("%d", &x);
if (x < 5) {
y = x-9;
printf("y的值是%d",y);
}else if(x>=5 && x<15){
y = 5*x-3;
printf("y的值是%d",y);
}else if(x>=15){
y = 6*x+9;
printf("y的值是%d",y);
}
void main()
{
/* Write C code in this online editor and run it. */
int x,y=0;
printf("enter 整数 x \n");
scanf("%d",&x);
if(x<5){
y = x-9;}
else if(x>=15){
y = 6*x+9;}
else{
y = 5*x-3;}
printf("%d",y);
}
int main()
{
int x, y;
scanf("%d", &x);
if (x < 5)
{
y = x - 9;
}
else if (x < 15)
{
y = 5 * x - 3;
}
else
{
y = 6 * x + 9;
}
printf("%d", y);
return 0;
}
#include <stdio.h>
int main(void)
{
float x;
printf("Please input the value of x :");
while (scanf("%f", &x)) {
if (x < 5)
printf("y = %g\n", x - 9);
else if (x >= 5 && x < 15)
printf("y = %g\n", 5 * x - 3);
else
printf("y = %g\n", 6 * x + 9);
printf("Please input the value of x :");
}
printf("Done!\n");
return 0;
}
int main() {
int x, y;
// printf{"please input one numble!\n"};
scanf("%d", &x);
if (x < 5) {
y = x - 9;
} else if (x < 15) {
y = 5 * x - 3;
} else {
y = 6 * x - 3;
}
登录后提交答案