Electricity board has decided to charge rupees based on the units consumed by a particular home. If the units consumed is less than or equal to 200, the cost for one unit is 0.5. If the unit is less than or equal to 400, the cost for one unit is 0.65 and Rs.100 extra charge. If the unit is less than or equal to 600, the cost for one unit is 0.80 and Rs.200 extra charge. If the unit is greater than 600 the cost for one unit is 1.25 and Rs.425 extra charge. You need to now calculate the electricity bill based on the units consumed (given input).
Answers
Following are the program that is given below
Explanation:
#include <stdio.h> // header file
int main() // main function
{
int con; // variable decration
float cost; // variable declaration
printf(" Enter the Input of the unit consumed by the customer : ");
scanf("%d",&con); // read the value by user
if (con <=200 ) // If the units consumed is less than or equal to 200
cost=0.5*con;
else if (con>200 && con<=400)// if the unit is less than or equal to 400
cost = (0.65*con)+100;
else if (con>400 && con<=600) //If the unit is less than or equal to600
cost=(0.80*con)+200;
else
cost=(1.25*con)+425;
printf("The amount of bill is:");
printf(" %f",cost); // display value
return 0;
}
Output:
Enter the Input of the unit consumed by the customer :120
The amount of bill is:60
Following are the description of program
- Declared a variable "con" that indicated the unit which is read by the user.
- Declared a variable "cost" of float type that will holding the the overall cost .
- We check the different condition that is mention in the question and store in the cost variable .
- Finally print the "cost".
Learn More :
- brainly.in/question/16710683