33,311
社区成员
发帖
与我相关
我的任务
分享
#include<stdio.h>
int main(){
int x, y;
scanf("%d", &x);
if(x < 0)
y = 0;
else if(x < 10)
y = x;
else if(x < 20)
y = 10;
else if(x <= 40)
y = 20 - 0.5 * x;
printf("%d\n", y);
}
#include<stdio.h>
main(){
int x,y;
scanf("%d",&x);
if(x<0)
y=0;
if(0<=x && x<10)
y=x;
if(10<=x && x<20)
y=10;
if(20<=x && x<=40)
y=20-0.5*x;
printf("%d\n",y);
}