72 547
Assignments Done
Successfully Done
In April 2019

Answer to Question #16766 in C++ for Hania

Question #16766
write a program to calculate electricity bill. if the units consumed are equal or less 100 then the cost of per unit is 5,if units consumed are more than 100 and less than 200 then the cost is 7 per unit and if units consumed are more than 200 then the cost is 9 per unit
Expert's answer

int U;
float C;

void main(){

cout<<"Consumed units: ";
if (U<=100) C = 5*(float)U;
if ((U>100)&&(U<=200)) C = 7*(float)U;
if (U>200) C = 9*(float)U;
cout<<"Price: "<<C<<"\n";

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions