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
15
Answer:#include<iostream>
using namespace std;
int main()
int a, b;
cin>>a;
if(a<=200)
cout<<"Rs."<<0.5*a;
else if(a<=400)
cout<<Rs."<<(0.65*a)+100;
else if(a<=600)
cout<<"Rs."<<(0.80*a)+200;
else
cout<<"Rs."<<(1.25*a)+425;
}
Explanation:
Answered by
7
Answer:
#include<iostream>
using namespace std;
int main()
{
int unit;
int amt;
cin>>unit;
if(unit<=200)
amt = unit*0.5;
if(unit>200 && unit<=400)
amt = amt + (unit-200)*0.65 + 100;
if(unit>400 && unit<=600)
amt = amt + (unit-400)*0.80 + 200;
if(unit>600)
amt = amt + (unit-600)*1.25 + 425;
cout<<"Rs."<<amt;
}
Explanation:
Similar questions