c语言编程练习题:7-78 计算油费
作者:yunjinqi   类别:    日期:2023-05-30 16:06:28    阅读:437 次   消耗积分:0 分    

image.png

#include <stdio.h>
#include <string.h>
int main(){
    int a,b;
    char c;
    if (scanf("%d %d %c", &a, &b, &c) == 3){
        double sum =0;
        if(b==90)
        {
            if(c=='m')
            {
                sum = 6.95*a*0.95;
            }
            else
                sum = 6.95*a*0.97;
        }
        else if(b==93)
        {
            if(c=='m')
            {
                sum = 7.44*a*0.95;
            }
            else
                sum = 7.44*a*0.97;
        }
        else
        {
            if(c=='m')
            {
                sum = 7.93*a*0.95;
            }
            else
                sum = 7.93*a*0.97;
        }

        printf("%.2f",sum);


    }else{
        printf("input wrong");
    }
    return 0;
}


版权所有,转载本站文章请注明出处:云子量化, http://www.woniunote.com/article/203
上一篇:c语言编程练习题:7-77 求1到100的和
下一篇:c语言编程练习题:7-79 N个数求和