程序:
#include <stdio.h>
int main()
{
int a;
double cost;
scanf("%d",&a);
if(a<=50){
if(a<0)printf("Invalid Value!");
else printf("cost = %.2f",a*0.53);
}
else printf("cost = %.2f",(50*0.53)+(a-50)*0.58);
return 0;
}
运行结果: