描述
练习完前面四个题,小明有点累了,就上上网,找找C语言的资料。碰巧看到这样一道题:输入一个正整数,然后从个位开始一次输出每一位数字对应的英文字母。例如:输入1532,输出two three five one。
输入
第一行输入一个T,代表有T组测试数据,T<100
对于每一组测试数据,输入一个整数x(0<x<100,000,000)
输出
对于每一组测试数据,输出对应结果,每个结果占一行,行末有空格
输入样例 1
3 24 1993 562431
输出样例 1
four two three nine nine one one three four two six five
#include<stdio.h>
int main()
{
int t,x,p;
char s[10][8]={"zero","one","two","three","four","five","six","seven","eight","nine"};
scanf("%d",&t);
for(int i=0; i<t; i++)
{
scanf("%d",&x);
while(x!=0)
{
p=x%10;
printf("%s ",s[p]);
x/=10;
}
printf("\n");
}
return 0;
}