由键盘输入一个10到99之间的整数将该数分解,分别输出其个位数和十位数字

1个回答

  • nt main(int argc,char* argv[])

    {

    char sound[10][5]={"yi","er","san","si","wu","liu","qi","ba","jiu","shi"

    };

    int x,y;

    printf("请输入数值(1-99):");

    scanf("%d",&x);

    if(x<1||x>99)

    printf("ERROR!超出范围.n");

    else if(x<10)

    printf("%sn",sound[x-1]);

    else if(x==10)

    printf("%sn",sound[9]);

    else if(x%10==0)

    {y=x/10;

    printf("%s-%sn",sound[y-1],sound[9]);}

    else

    { y=x/10;

    x=x-y*10;

    printf("%s-%s-%sn",sound[y-1],sound[9],sound[x-1]);

    }

    return 0;

    }