Advertisement
nguyenhappy92

Tính tiền điện theo tháng

Nov 24th, 2015
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. // Khai bao ham thu vien neu co
  2. #include<stdio.h>
  3. #include<conio.h>
  4. // chuong trinh chinh
  5. void main()
  6. {
  7. int x;
  8. scanf("%d",&x);
  9. double tien;
  10. if(x>=0 && x<=500)
  11. {
  12. if(x<49)// 48kwh dau tien
  13. {
  14. tien=x*600;
  15. printf("%.0lf\n",tien);
  16. }
  17. else
  18. if(x<97)// tiep the0
  19. {
  20. tien=28800+(x-48)*1004;
  21. printf("%.0lf\n",tien);
  22. }
  23. else
  24. if(x<145)// ke tiep
  25. {
  26. tien=76992+(x-96)*1214;
  27. printf("%.0lf\n",tien);
  28. }
  29. else // cac truong hop tu 145 kwh tro di
  30. {
  31. tien=135264+(x-144)*1594;
  32. printf("%.0lf\n",tien);
  33. }
  34. }
  35. else
  36. printf("0");
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement