c语言,关于电费问题的编程

用电量 收费标准
0-200 x×0.5元
201-400 100+(x-200)×0.65元
401-600 230+(x-400)×0.8元
601以上 390+(x-600)×1.0元

编写程序,对于一个输入的用电数量,计算用户的缴费额。

#include<stdio.h>
int main(void)
{
        float a;
        float cost;
        printf("请输入使用电量:");
        scanf("%f", &a);
        if (a <= 200){
                cost = a*0.5;
                printf("电费: %.2f\n", cost);
        }else if (a > 200 && a <= 400){
                cost = 100 + (a - 200) * 0.65;
                printf("电费: %.2f\n", cost);
        }else if (a > 400 && a <= 600){
                cost = 230 + (a - 400) * 0.80;
                printf("电费: %.2f\n", cost);
        }else {
                cost = 390 + (a - 900) * 1.0;
                printf("电费: %.2f\n", cost);
        };
}

有用请采纳,谢谢!