念整数
程序员文章站
2022-05-03 18:35:36
#include #include int main(int argc, const char * argv[]) { // insert code here... int i; scanf("%d",&i); int n=0; if(i<0) { printf ......
#include <stdio.h>
#include <math.h>
int
main(
int
argc,
const
char
* argv[]) {
// insert code here...
int
i;
scanf
(
"%d"
,&i);
int
n=0;
if
(i<0)
{
printf
(
"fu "
);
i=i*-1;
}
int
m=i;
while
(m>0)
{
m=m/10;
n++;
}
if
(i==0)
{
printf
(
"ling\n"
);
}
for
(
int
j=n-1;j>=0;j--)
{
int
b=i/(
pow
(10,j));
i=i%(
int
)
pow
(10,j);
switch
(b)
{
case
0:
printf
(
"ling"
);
break
;
case
1:
printf
(
"yi"
);
break
;
case
2:
printf
(
"er"
);
break
;
case
3:
printf
(
"san"
);
break
;
case
4:
printf
(
"si"
);
break
;
case
5:
printf
(
"wu"
);
break
;
case
6:
printf
(
"liu"
);
break
;
case
7:
printf
(
"qi"
);
break
;
case
8:
printf
(
"ba"
);
break
;
case
9:
printf
(
"jiu"
);
break
;
}
if
(j!=0)
{
printf
(
" "
);
}
else
{
printf
(
"\n"
);
}
}
}
上一篇: 牵手相伴走天涯——搭车去拉萨
下一篇: 国内水上乐园哪个好玩 国内水上乐园有哪些