比着葫芦画瓢



#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
    int t;
    float x,y;
    scanf("%f",&x);
    t=(x<2)+(x<6)+(x<10);
    switch(t)
    {
        case 3:y=x;break;
        case 2:y=x*x+1;break;
        case 1:y=sqrt(x+1);break;
        case 0:y=1/(x+1);break;
    }
    printf("%f",y);
    return 0;
}



#include <stdio.h>
#include <stdlib.h>

int main()
{
    int c,s;
    float p,w,d,f;
    printf("please enter p,w,s:");
    scanf("%f%f%d",&p,&w,&s);
    if (s>=3000)
        c=12;
    else
        c=s/250;
    switch(c)
    {
        case 0:d=0;break;
        case 1:d=2;break;
        case 2:
        case 3:d=5;break;
        case 4:
        case 5:
        case 6:
        case 7:d=8;break;
        case 8:
        case 9:
        case 10:
        case 11:d=10;break;
        case 12:d=15;break;
    }
f=p*w*s*(1-d/100.0);
printf("freight=%.2f\n",f);
return 0;
}



#include <stdio.h>
#include <stdlib.h>

int main()
{
    int x,y;
    scanf("%d",&x);
    y=(x>0)?x:-x;
    printf("%d",y);
    return 0;
}

#include <stdio.h>
#include <stdlib.h>

int main()
{
    double x;
    scanf("%lf",&x);
    printf("%lf",(x>0)?x:-x);
    return 0;
}






  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值