当前位置:网站首页>2.2 step tariff
2.2 step tariff
2022-06-25 19:57:00 【Then peace and happiness】
In order to encourage residents to save electricity , Executed by a power company “ Step Tariff ”, The electricity price of residential users who install one household one meter is divided into two “ ladder ”: Monthly electricity consumption 50 KWH ( contain 50 KWH ) Inside , The electricity price is 0.53 element / KWH ; exceed 50 Kilowatt hour , Excess power consumption , Price hike 0.05 element / KWH . Please write a program to calculate the electricity charge .
Input format :
Enter the monthly electricity consumption of a user in one line ( Company : KWH ), Be careful : Electricity consumption is not necessarily an integer .
Output format :
Output the electricity charge that the user should pay in one line ( element ), Two decimal places are reserved for the result , The format is as follows :“cost = Value of electricity charges payable ”; If the power consumption is less than 0, The output "Invalid Value!".
sample input 1:
10
sample output 1:
cost = 5.30
sample input 2:
100
sample output 2:
cost = 55.50Code :
#include <stdio.h>
int main(void)
{
double x,cost;
scanf("%lf", &x);
if(x>50)
{
cost=50*0.53+(x-50)*0.58;
printf("cost = %.2f", cost);
}
else if(x>0&&x<=50)
{
cost=0.53*x;
printf("cost = %.2f", cost);
}
else
printf("Invalid Value!\n");
return 0;
} 边栏推荐
- Pat b1054 average (20 points)
- Mqtt+ardunio+esp8266 development (excluding mqtt server deployment)
- PostgreSQL user role permissions
- Est - il sûr d'ouvrir un compte avec de nouvelles dettes? Une faible Commission est - elle crédible?
- Applet multi image to Base64 upload
- Network security detection and prevention test questions (4)
- Trend ea- fixed stop loss and profit per order
- ECS 7-day practical training camp (Advanced route) -- day03 -- ecs+slb load balancing practice
- 在打新債開戶證券安全嗎?低傭金靠譜嗎
- Vulnhub range the planes: mercury
猜你喜欢

Automatic fitting when the applet reaches the top

PostgreSQL user role permissions

Apifox simple understanding -- the integrator of web side testing

Miner's Diary: why should I go mining on April 5, 2021

Panda weekly -2022/02/18

Gbpnzd firm offer for 14 months, simulation for 19 months, test stable

mysql load data infile

One night I worked as an XPath Terminator: XPath Helper Plus

Wechat applet cloud function does not have dependency option installed

Wechat applet connects to the server to display mqtt data information
随机推荐
The functions in the applet page are better than those in app JS first execution solution
JS mobile phone and computer open different websites
Vulnhub range the planes: mercury
Database data type design (the most detailed in the whole network)
Is it safe to open an account with flush?
MySQL prompt performance_ Schema missing table
Jsonp function encapsulation
Server journey from scratch - Yu Zhongxian integrated version (IP access server, LNMP compilation and installation, Lua environment and socket expansion)
Bloom filter
Life cycle function of composite API
Trend ea- fixed stop loss and profit per order
Convert word to PDF through libreoffice
DataX script task development record
What should I pay attention to in GoogleSEO content station optimization?
ActiveMQ--CVE-2016-3088
Process of vacuum and vacuum full
Web components - Basics
3、 Hikaricp source code analysis of connection acquisition process III
JS advanced
Bindgetuserinfo will not pop up