7-8 recite numbers (15 points)

7-8 recite numbers (15 points)

Enter an integer and output the pinyin corresponding to each number. When the integer is negative, the fu word is output first. The pinyin corresponding to the ten numbers is as follows:

0: ling
1: yi
2: er
3: san
4: si
5: wu
6: liu
7: qi
8: ba
9: jiu
Input format:
input gives an integer in one line, such as: 1234.

Tip: Integers include negative, zero, and positive numbers.

Output format:
output the pinyin corresponding to this integer in one line. The pinyin of each number is separated by a space, and there is no final space at the end of the line. Such as yi er san si.

Input sample:
-600
Output sample:
fu liu ling ling

c language:

#include<stdio.h>
int main(void)
{
    
    
char c;
c=getchar();
while(c!='\n'){
    
    
if(c=='-') printf("fu");
else if(c=='0') printf("ling");
else if(c=='1') printf("yi");
else if(c=='2') printf("er");
else if(c=='3') printf("san");
else if(c=='4') printf("si");
else if(c=='5') printf("wu");
else if(c=='6') printf("liu");
else if(c=='7') printf("qi");
else if(c=='8') printf("ba");
else if(c=='9') printf("jiu");
c=getchar();
if(c!='\n')
printf(" ");
}
return 0;
}

Java:

待更新

Guess you like

Origin blog.csdn.net/xiahuayong/article/details/109055701