7-11 分段计算居民水费(10 分)

#include
int main(){
    int x;
    double y;
    scanf("%d",&x);
    if(x>15){
        y=2.5*x-17.5;
    }
    else {
     y=4*x/3;   
    }
    printf("%.2f\n",y);
}

a.c: In function ‘main’:
a.c:5:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf(“%d”,&x);
^~~~~~~~~~

你可能感兴趣的:(cai)