/************************************************
Project:Test
Create:TTHHR
Date:2016.9.21
************************************************/
#include<stdio.h>
float value(float a);
int main()
{
float m;
printf("请输入(千瓦时):\n");
scanf("%f",&m);
printf("应付电费:%.2f\n",value(m));
return 0;
}
float value(float a)
{
float value;
if(a>50)
value=50*0.53+(a-50)*0.58;
else
value=a*0.53;
return value;
}
Project:Test
Create:TTHHR
Date:2016.9.21
************************************************/
#include<stdio.h>
float value(float a);
int main()
{
float m;
printf("请输入(千瓦时):\n");
scanf("%f",&m);
printf("应付电费:%.2f\n",value(m));
return 0;
}
float value(float a)
{
float value;
if(a>50)
value=50*0.53+(a-50)*0.58;
else
value=a*0.53;
return value;
}