fork download
  1.  
  2. /***************************************************
  3.  * Author : CS Developers
  4.  * Author URI: https://w...content-available-to-author-only...v.com
  5.  * Facebook : https://w...content-available-to-author-only...k.com/CSDevelopers
  6.  ***************************************************/
  7.  
  8. #include<stdio.h>
  9. #define VAT 7.0
  10.  
  11. int main()
  12. {
  13. int unit, unit_use, pay=0, service_charge;
  14. float bill = 0;
  15.  
  16. printf("\n Enter water unit : ");
  17. scanf("%d", &unit);
  18.  
  19. if(unit > 100){
  20. unit_use = unit - 100;
  21. pay += unit_use * 15;
  22. unit -= unit_use;
  23. }
  24.  
  25. if(unit > 40 && unit <= 100){
  26. unit_use = unit - 40;
  27. pay += unit_use * 10;
  28. unit -= unit_use;
  29. }
  30.  
  31. if(unit > 20 && unit <= 40){
  32. unit_use = unit - 20;
  33. pay += unit_use * 7;
  34. unit -= unit_use;
  35. }
  36.  
  37. if(unit > 10){
  38. pay += unit * 5;
  39. }
  40.  
  41. printf(" Enter Service charge : ");
  42. scanf("%d", &service_charge);
  43.  
  44. bill = pay + service_charge;
  45. printf("\n\n Water bill before VAT is %.2f Bath", bill);
  46.  
  47. bill = bill * ( 1 + (VAT / 100));
  48. printf("\n VAT %.2f%% is %.2f Bath", VAT, (bill * VAT) / (100+VAT));
  49.  
  50. printf("\n\n Total water bill is %.2f Bath\n", bill);
  51.  
  52. return 0;
  53. }
Success #stdin #stdout 0.01s 5252KB
stdin
Standard input is empty
stdout
 Enter water unit :  Enter Service charge : 

 Water bill before VAT is -1614260736.00 Bath
 VAT 7.00% is -112998252.86 Bath

 Total water bill is -1727259008.00 Bath