输出各个数字
#include <stdio.h> main() { int shu,ge=0,shi=0,bai=0,qian=0; scanf("%d",&shu); if(shu<=0 || shu>=10000) printf("输入错误"); else { if(shu>=1 && shu<=9) ge=shu; if(shu>=10 && shu<=99) ge=shu%10,shi=shu/10; if(shu>=100&& shu<=999) ge=shu%10,bai=shu/100,shi=(shu-bai*100)/10; if(shu>=1000 && shu<=9999) ge=shu%10,qian=shu/1000,bai=(shu-qian*1000)/100,shi=(shu-qian*1000-bai*100)/10; printf("%d,%d,%d,%d",qian,bai,shi,ge); } getchar(); }