Advertisement
Guest User

ข้อ1 ปฏิบัติ

a guest
Aug 31st, 2015
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. void main()
  4. {
  5. int money;
  6. float tax = 0;
  7. printf("enter money: ");
  8. scanf("%d", &money);
  9. if (money > 1)
  10. {
  11. tax = money * 0;
  12. }
  13. if (money > 150000)
  14. {
  15. tax = 150000 * 0 + ((money-150000) * 0.05);
  16. }
  17. if (money > 300000)
  18. {
  19. tax = 150000 * 0 + (150000 * 0.05) + ((money - 300000) * 0.10);
  20. }
  21. if (money > 500000)
  22. {
  23. tax = 150000 * 0 + (150000 * 0.05) + (200000 * 0.10) + ((money - 500000) * 0.15);
  24. }
  25. if (money > 750000)
  26. {
  27. tax = 150000 * 0 + (150000 * 0.05) + (200000 * 0.10) + (250000 * 0.15) + ((money - 750000) * 0.20);
  28. }
  29. if (money > 1000000)
  30. {
  31. tax = 150000 * 0 + (150000 * 0.05) + (200000 * 0.10) + (250000 * 0.15) + (250000 * 0.20) + ((money - 1000000) * 0.25);
  32. }
  33. if (money > 2000000)
  34. {
  35. tax = 150000 * 0 + (150000 * 0.05) + (200000 * 0.10) + (250000 * 0.15) + (250000 * 0.20) + (1000000 * 0.25) + ((money - 2000000) * 0.30);
  36. }
  37. if (money > 4000000)
  38. {
  39. tax = 150000 * 0 + (150000 * 0.05) + (200000 * 0.10) + (250000 * 0.15) + (250000 * 0.20) + (1000000 * 0.25) + (2000000 * 0.30) + ((money - 4000000)*0.35);
  40. }
  41. printf("Tax = %.0f\n", tax);
  42. printf("Tax Rate = %.2f%%\n", (tax*100)/money);
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement