Advertisement
fahimkamal63

Electricity bill

Oct 20th, 2019
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.57 KB | None | 0 0
  1. //  Electricity bill
  2. //  Date : 20.10.19
  3. #include<iostream>
  4. using namespace std;
  5.  
  6. int main(){
  7.     cout << "Enter the used electric unit: ";
  8.     int unit; cin >> unit;
  9.     double bill = 0;
  10.     if(unit > 250){
  11.         bill = (50 * 0.50) + (100 * 0.75) + (100 * 1.20) + ((unit - 250) * 1.50);
  12.     }
  13.     else if(unit > 150){
  14.         bill = (50 * 0.5) + (100 * 0.75) + ((unit - 150) * 1.20);
  15.     }
  16.     else if( unit > 50){
  17.         bill = (50 * 0.5) + ((unit - 50) * 0.75);
  18.     }
  19.     else bill = unit * 0.5;
  20.  
  21.     bill = bill + ((20 * bill) / 100);
  22.  
  23.     cout << bill;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement