#include <stdio.h>

int main()
{
    int n;
    scanf("%d", &n);
    int cnt = 0, temp = n;
    while (temp > 0) {
        cnt++;
        temp /= 10;
    }
    printf("%d位数\n", cnt);
    printf("每一位数字:");
    while (n > 0) {
        printf("%d ", n % 10);
        n /= 10;
    }
    printf("\n逆序打印:");
    while (temp > 0) {
        printf("%d ", temp % 10);
        temp /= 10;
    }
    return 0;
}
C语言编程:三位正整数的位数判断、数字提取和逆序打印

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

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