fork download
  1. #include <stdio.h>
  2.  
  3. int main()
  4. {
  5. int units;
  6. float bill;
  7.  
  8. scanf("%d", &units);
  9.  
  10. if (units <= 200)
  11. bill = 0;
  12.  
  13.  
  14. else if (units <= 400)
  15. bill = (units - 200) * 5;
  16.  
  17.  
  18.  
  19. else if (units <= 600)
  20. bill = 200 * 5 + (units - 400) * 7;
  21.  
  22.  
  23.  
  24. else if (units <= 800)
  25. bill = 200 * 5 + 200 * 7 + (units - 600) * 9;
  26.  
  27.  
  28.  
  29. else
  30. bill = 200 * 5 + 200 * 7 + 200 * 9 + (units - 800) * 11;
  31.  
  32.  
  33.  
  34.  
  35. printf("electricity bill = %.0f rs", bill);
  36.  
  37.  
  38.  
  39. return 0;
  40. }
  41.  
Success #stdin #stdout 0.01s 5320KB
stdin
201
stdout
electricity bill = 5 rs