Advertisement
rajuahammad73

Electric Bill Calculator

Jun 22nd, 2019
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5.     float units, sc=100, vat=15, bill;  // sc = service charge, vat 15% if total bill is more than 400.
  6.    
  7.     printf("Please give your Used Electric Units\n");
  8.    
  9.     scanf("%f", &units);
  10.    
  11.     if(units >= 0 && units <= 200){
  12.         bill = (units*0.8)+sc;
  13.     } else if(units > 200 && units <= 300){
  14.         bill = (units*0.9)+sc;
  15.     } else {
  16.         bill = (units*1)+sc;
  17.     }
  18.    
  19.     if(bill >= 400){
  20.         bill = bill + (bill*(vat/100));
  21.     }
  22.    
  23.     printf("Your Total Payable Bill is %.2f Tk.", bill);
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement