#include <stdio.h> int main() { char sh[13][6]={"个","十","百","千","万","十万","百万","千万","亿","十亿","百亿","千亿","万亿"}; // int cc=0; // for(cc=0;cc<=13;cc++) // { // printf("%s\n",sh[cc]); // } int bla,sum,shu; scanf("%d",&bla); sum=0; int aa=0; while (bla!=0) { shu=bla%10; bla=bla/10; sum=sum+shu; printf("数字的%4s位数为%5d\n",sh[aa],shu); aa++; } printf("\n%d",sum); getchar(); }
结果: