fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3.  
  4. int main() {
  5. const char numeric_label[][4] = {"", "일", "이", "삼", "사", "오", "육", "칠", "팔", "구", "십"}, subunit_label[][4] = {"", "십", "백", "천"}, unit_label[][4] = {"", "만", "억", "조", "경", "해", "자", "양", "구", "간", "정", "재", "극"};
  6. char money[100] = "", *money_ptr = money;
  7. scanf("%s", money);
  8.  
  9. size_t money_len = strlen(money);
  10. if(money_len == 1 && *money_ptr == '0') printf("영"); else
  11. while(*money_ptr) printf("%s%s ", (char *)numeric_label + (*money_ptr++ - 0x30 << 2), (--money_len & 3) ? (char *)subunit_label + ((money_len & 3) << 2) : (char *)unit_label + (money_len & -4));
  12. putchar('\n');
  13.  
  14. return 0;
  15. }
Success #stdin #stdout 0s 3416KB
stdin
123141234123456
stdout
일백 이십 삼조 일천 사백 일십 이억 삼천 사백 일십 이만 삼천 사백 오십 육