62 570
Assignments Done
99%
Successfully Done
In June 2018

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
#include<iostream.h>

int U;
float C;

void main(){

cout<<"Consumed units: ";
cin>>U;
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!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions