fork download
  1.  
  2. #include <stdio.h>
  3.  
  4. int main() {
  5. int unit,bill;
  6. printf("enter number of unit used \n");
  7. scanf("%d",&unit);
  8. if(unit<=0){
  9. printf("you don't have to pay anything");
  10. }
  11.  
  12. else if (unit<=100){
  13. bill= 5*unit;
  14. printf("according to it you have to pay %d rupees",bill);
  15. }
  16. else if (unit<=200){
  17. bill=(100*5+(unit-100)*7);
  18. printf("you have to pay %d rupees",bill);
  19. }
  20. else if (unit<=300){
  21. bill=((100*5)+(100*7)+(unit-200)*10);
  22. printf("you have to pay %d rupees",bill);
  23. }
  24. else{
  25. bill=((100*5)+(100*7)+(100*10)+(unit-300)*12);
  26. printf("you have to pay %d rupees",bill);
  27. }
  28. return 0;
  29. }
Success #stdin #stdout 0s 5284KB
stdin
350
stdout
enter number of unit used 
you have to pay 2800 rupees