English, asked by mohanteja5555, 10 months ago

write a c++ programElectricity 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 soumensabui100
3

Answer:

/**

* C program to calculate total electricity bill

*/

#include <stdio.h>

int main()

{

   int unit;

   float amt, total_amt, sur_charge;

   /* Input unit consumed from user */

   printf("Enter total units consumed: ");

   scanf("%d", &unit);

   /* Calculate electricity bill according to given conditions */

   if(unit <= 50)

   {

       amt = unit * 0.50;

   }

   else if(unit <= 150)

   {

       amt = 25 + ((unit-50) * 0.75);

   }

   else if(unit <= 250)

   {

       amt = 100 + ((unit-150) * 1.20);

   }

   else

   {

       amt = 220 + ((unit-250) * 1.50);

   }

   /*

    * Calculate total electricity bill

    * after adding surcharge

    */

   sur_charge = amt * 0.20;

   total_amt  = amt + sur_charge;

   printf("Electricity Bill = Rs. %.2f", total_amt);

   return 0;

}

Explanation:

Answered by manoj2425
10

Answer:

#include <iostream>

using namespace std;

int main()

{

int unit;

int amt, total_amt, sur_charge;

cin>>unit;

if(unit <=200)

{

 amt = unit * 0.50;

}

else if(unit <= 400)

{

amt = 100 + ((unit-200) * 0.65);

}

else if(unit <= 600)

{

amt = 200 + ((unit-400) * 0.80);

}

else

{

amt = 425 + ((unit-600) * 1.25);

}

sur_charge = amt * 0.001;

total_amt= amt + sur_charge;

cout<<"Rs."<<total_amt;

return 0;

}

Explanation:

Similar questions