A water supply company charges the water consumption, as follows: a) Fixed amount of 10$. b) For the first 30 cubic meters 0.6$/meter. c) For the next 20 cubic meters 0.8$/meter. d) For the next 10 cubic meters 1$/meter. e) For every additional meter 1.2$/meter. Write a program that reads the water consumption in cubic meters and displays the bill. 寫一個輸入水的用量 輸出水費的程式 Example Input:
25
Output:
Cost: 25.00
Example Input 2:
44
Cost: 39.20
Example Input 3:
75
Cost: 72.00
Hidden content!#include <stdio.h>int main(){ * *** * * **** * * a; ** * *** * * * *** *** ** ** * * * * ** * * * ** * **** * *** * * * * * (a<=30) * * ** * * ** * * ** **** ** * * * * * * ***** * ** * ** * ** * %.2f",a*0.6+10);