#include <stdio.h>

int main() { int n, count=0; scanf('%d', &n); int temp = n; while(temp != 0) { // 循环计算位数 count++; temp /= 10; } printf('%d位数 ', count); while(n != 0) { // 循环取出每一位数字并打印 printf('%d ', n % 10); n /= 10; } printf(' '); n = temp; while(n != 0) { // 循环取出每一位数字并按逆序打印 printf('%d ', n % 10); n /= 10; } return 0; }

C语言实现正整数的位数判断和数字拆分打印

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

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