c语言的学习路程———整数分解
#include<stdio.h> int main() { int a; scanf_s("%d", &a); int x = a; int count = 0; int mask = 1; while (a > 9) { a /= 10; mask *= 10; count++; } printf("count=%d\n", count); printf("mask=%d\n", mask); do { int d = x / mask; printf("%d", d); if (mask > 0) { printf(" "); } x %= mask; mask /= 10; } while (mask > 0); printf("\n"); return 0; }