#include <stdio.h>

int main()
{
    int n, digit, count = 0;
    scanf("%d", &n);
    int temp = n; // 用temp保存n,因为后面需要改变n的值
    while (temp)
    {
        digit = temp % 10; // 取出最低位数字
        count++; // 位数加一
        printf("%d ", digit); // 打印每一位数字
        temp /= 10; // 去掉最低位数字
    }
    printf("\n");
    while (n)
    {
        digit = n % 10; // 取出最低位数字
        printf("%d ", digit); // 按逆序打印每一位数字
        n /= 10; // 去掉最低位数字
    }
    printf("\n%d位数", count);
    return 0;
}

原文地址: https://www.cveoy.top/t/topic/Nfi 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录