Write this number (20) and write 20
Read a natural number n, calculate the sum of all its numbers, and write each digit in Chinese pinyin.
Input Format:Each test input contains one test case, that is, the value of natural number n. N must be less than 10100.
Output Format:Output each digit of n in a row. There is a space between the pinyin numbers, but there is no space after the last pinyin number in a row.
Input example:
1234567890987654321123456789
Sample output:
yi san wu
1 #include <stdio.h>
2 #include <string.h>
3
4 void print_num (int num)
5 {
6 char num_str [4] = {0};
7 sprintf (num_str, "% d", num);
8 char * temp = num_str;
9 while (* temp! = '\ 0')
10 {
11 switch (* temp)
12 {
13 case '0':
14 printf ("ling");
15 break;
16 case '1':
17 printf ("yi");
18 break;
19 case '2':
20 printf ("er");
21 break;
22 case '3':
23 printf ("san");
24 break;
25 case '4':
26 printf ("si");
27 break;
28 case '5':
29 printf ("wu");
30 break;
31 case '6':
32 printf ("liu");
33 break;
34 case '7':
35 printf ("qi");
36 break;
37 case '8':
38 printf ("ba");
39 break;
40 case '9':
41 printf ("jiu");
42 break;
43 default:
44 break;
45}
46 temp ++;
47 if (* temp! = '\ 0')
48 printf ("");
49 else
50 printf ("\ n");
51}
52}
53
54 int main (int argc, char * argv [])
55 {
56 char num [101] = {0};
57 char * temp = num;
58 int total = 0;
59 scanf ("% s", num);
60 while (* temp! = '\ 0')
61 {
62 total + = (* temp-'0');
63 temp ++;
64}
65 print_num (total);
66 return 0;
67}