解题思路:
我的代码适合一切位数的数!!




注意事项:





参考代码:

#include <stdio.h>
#include <stdlib.h>
#include<string.h>
#include<math.h>

int main()
{
    char b[10];
    int i=0;
    int n;
    scanf("%d",&n);
    int digit=0;
    int mark=1;
    int t=n;
    while(t>9)
    {
        mark*=10;
        t/=10;
    }
    //printf("%d",mark);

    while(mark>0)
    {
        digit=n/mark;
        n=n%mark;
        mark=mark/10;
        b[i]=digit+'0';
        printf("%c",b[i]);
        if(mark>0)
        {
            printf(" ");
        }
        i++;
    }

    return 0;
}


 

0.0分

0 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答

代码解释器

  评论区