Computer Science, asked by Shivaprakashv, 8 months ago

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

Answered by StaceeLichtenstein
0

Following are the program In C++ Language  that is given below.

Explanation:

#include <iostream> // header file

using namespace std; // namespace

int main()  // main function

{

   int unit; // variable decration

   float  amt1; // variable declaration  

 cout<<" Enter the Input unit:";

 cin>>unit; // read the value by user

  if (unit <=200 ) // If the units consumed is less than or equal to 200

amt1=0.5*unit;  

  else if (unit>200 && unit<=400)// if the unit is less than or equal to 400

 amt1 = (0.65*unit)+100;

else if (unit>400 && unit<=600) //If the unit is less than or equal600

  amt1=(0.80*unit)+200;

 else

  amt1=(1.25*unit)+425;

 cout<<" the cost is:"<<amt1;

return 0;

}  

Output:

Enter the Input unit :100

The cost is :50

Following are the description of program

  • Declared a variable "unit" that indicated the unit which is read by the user.
  • Declared a variable "amt1" of float type that will holding the the overall cost
  • We check the different condition that are given in the question and store in the "amt1 "variable .
  • Display the "amt1".

Learn More :

  • brainly.in/question/16710683

Answered by gayathrisaranam9
2

#include<iostream>

using namespace std;

int main()

{

 int unit,total_amt;    

 float amt;      

 cin>>unit;    

 if(unit <=200)    

 {        

   amt = unit * 0.50;    

 }    

 else if(unit <= 400)    

 {        

   amt = (unit*0.65)+100;    

 }    

 else if(unit <= 600)    

 {        

   amt = 200 + (unit * 0.80);    

 }    

 else    

 {        

   amt = 425 + (unit * 1.25);    

 }      

 total_amt  = amt;    

 cout<<"Rs."<<total_amt;

 return 0;

}

Similar questions