Advertisement
nguyenhappy92

Tính cước sử dụng ADSL trong tháng

Oct 16th, 2015
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. // Tinh tien thue bao ADSL
  2. // Khai bao cac ham thu vien neu co
  3. #include<stdio.h>
  4. #include<conio.h>
  5.  
  6. void main()
  7. {
  8. long n;
  9. scanf("%ld",&n);
  10. long s=0;
  11. if(n<500&&n>0)
  12. {
  13. s=s+ 500*50;
  14. }
  15. else
  16. {
  17. if(n<=1000&&n>500)
  18. {
  19. s=s+ (500*50)+((n-500)*40);
  20. }
  21. else
  22. {
  23. if(n<=1500&&n>1000)
  24. {
  25. s=s+ (500*50)+((n-500)*40)+((n-500-500)*30);
  26. }
  27. else
  28. {
  29. s=s+ (500*50)+((n-500)*40)+((n-500-500)*30)+ ((n-1500)*20);
  30. }
  31. }
  32. }
  33. if(s>100000000)
  34. {
  35. printf(" So tien khach hang phai tra la: 299000 dong\n");
  36. }
  37. else
  38. {
  39. printf(" So tien khach hanh can thanh toan: %ld dong\n",s);
  40. }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement