题解 | #网购#

网购

https://www.nowcoder.com/practice/5d7dfd405e5f4e4fbfdff6862c46b751

#include <stdio.h>

int main()
{
    unsigned int month = 0, date = 0, discount = 0;
    float money = 0.0f;
    double sum = 0;
    int i = 1;
    scanf("%f%d%d%d", &money, &month, &date, &discount);
    while (month == 11 && date == 11)
    {
        if (discount == 1)
        {
            sum = money * 0.7 - 50;
        }
        else
        {
            sum = money * 0.7;
        }
        if (sum < 0)
        {
            sum = 0;
        }
        break;
    }
    while (month == 12 && date == 12)
    {
        if (discount == 1)
        {
            sum = money * 0.8 - 50;
        }
        else
        {
            sum = money * 0.8;
        }
        if (sum < 0)
        {
            sum = 0;
        }
        break;
    }
    printf("%.2f", sum);
    return 0;
}

全部评论

相关推荐

评论
点赞
收藏
分享
牛客网
牛客企业服务