实验4-1 求花费电费的金额

#include<stdio.h>
int main(void)
{
    int i,n;
    double x,y;
    printf("The enter n:");
    scanf("%d",&n);
    for(i=1;i<n;i++){
        printf("The enter x:");
        scanf("%lf",&x);
        if(x<=0){
            printf("The enter is wrong");
        }
            if(x<=50){
                y=0.53*x;
            printf("y=%.2f
",y);
            }
            if (x>50){
                y=0.53*50+(x-50)*0.58;
            printf("y=%.2f
",y);
    }
    }
        return 0;
}

原文地址:https://www.cnblogs.com/shenyunwen/p/3373756.html