#include <stdio.h>

int main()
{
    float weight, fee;
    printf("请输入邮件重量(kg):");
    scanf("%f", &weight);
    if (weight <= 1)
    {
        fee = 10;
    }
    else if (weight > 1)
    {
        int delta = weight - 1;
        if (delta % 0.5 == 0)
        {
            fee = 10 + delta / 0.5 * 3;
        }
        else
        {
            fee = 10 + (delta / 0.5 + 1) * 3;
        }
    }
    printf("邮费为:%.2f元\n", fee);
    return 0;
}

原文地址: https://www.cveoy.top/t/topic/YoW 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录