Guest User

Untitled

a guest
Nov 18th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main(void) {
  5. int income, taxLength, i;
  6. char strTax[100], *taxPointer;
  7. double tax;
  8. printf("총 소득(원)을 입력하세요 : ");
  9. scanf("%d", &income);
  10.  
  11. if(income <= 10000000) {
  12. tax = income * 0.08;
  13. }
  14. else if(income > 10000000 && income <= 40000000) {
  15. tax = income * 0.17;
  16. }
  17. else if(income > 40000000 && income <= 80000000) {
  18. tax = income * 0.26;
  19. }
  20. else {
  21. tax = income * 0.35;
  22. }
  23.  
  24. tax = (int)(tax + 0.5);
  25. tax = ((int)tax / 10) * 10;
  26.  
  27. sprintf(strTax, "%d", (int)tax);
  28. taxLength = strlen(strTax);
  29. taxPointer = strTax;
  30. printf("%c", taxPointer);
  31. printf("최종 부과세금 : ");
  32. for(i = taxLength; i > 0;) {
  33. printf("%c", *taxPointer++);
  34. i--;
  35. if(i > 0 && i % 3 == 0) {
  36. printf(",");
  37. }
  38. }
  39. printf("\n");
  40. }
Add Comment
Please, Sign In to add comment