萌新大神求帮助 2022-09-08 23:56 采纳率: 50%
浏览 57
已结题

求指正错误我看了很久也改了很久但就是不能解决

img

img

#include<stdio.h>
int main()
{
    int x,y,z,sum,b,n;
    double price,first,second,three;
    scanf("%d %d",&x,&y);
    b=x;n=y;
    sum=x+y;
    if(sum<=2760){
        price=0.538*y;
        printf("%.2f",price);
    }
    else if(2760<sum&&sum<=4800){
        if(x<=2760)
        {    
            z=2760-x;
            b=y-z;
            first=0.538*z;
            second=0.588*b;
            price=first+second;
            printf("%.2f",price);
        }
        else{
            price=y*0.588;
            printf("%.2f",price);
        }
    }
    else if(sum>4800)
    {
        if(x<=2760){
            b=2760-x;
            first=0.538*b;
            second=0.588*2040;
            z=y-4800;
            three=z*0.838;
            price=first+second+three;
            printf("%.2f",price);
        }
        else if(x>2760&&x<=4800){
            b=4800-x;
            first=0.588*b;
            z=y-b;
            second=0.838*z;
            price=first+second;
            printf("%.2f",price);
        }
        else if(x>4800)
        {
            first=y*0.838;
            printf("%.2f",first);
        }
    }
}

  • 写回答

2条回答 默认 最新

  • 决明- 2022-09-09 00:26
    关注

    img


    0.538*y

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 9月17日
  • 已采纳回答 9月9日
  • 修改了问题 9月9日
  • 修改了问题 9月9日
  • 展开全部