程序代码:
#include<stdio.h> int main() {long int num,a1,a2,a3,a4,a5,n=1; prinf("Please input a number (0-99999) "); scanf("%ld",&num); a1=num%10;/*first*/ a2=num/10;/*2ed*/ if (a2==0) /*XXX关系运算*/{n=n;printf("PLACE% ld\n,ge wei %ld\n,dao xu%ld",n,a1,a1);} else{ a3=num/100;/*3rd*/ if (a3==0) {n=n+1;printf("PLACE %ld\n,ge wei %ld,shi wei %ld\n,dao xu %ld,%ld",n,a1,a2,a1,a2);} else{ a4=num/1000;/*4th*/ if (a4==0) {n=n+2;num=num-a3*100;a2=num/10;printf("PLACE %ld\n,ge wei %ld,shi wei %ld,bai wei %ld\n,dao xu %ld,%ld,%ld",n,a1,a2,a3,a1,a2,a3);} else{ a5=num/10000;/*5th*/ if (a5==0){n=n+3;num=num-a4*1000;a3=num/100;num=num-a3*100;a2=num/10;printf("PLACE %ld\n,ge wei %ld,shi wei %ld,biwei %ld,qian wei %ld\n,dao xu %ld,%ld,%ld,%ld",n,a1,a2,a3,a4,a1,a2,a3,a4);} else{ {n=n+4;num=num-a5*10000;a4=num/1000;num=num-a4*1000;a3=num/100;num=num-a3*100;a2=num/10;printf("PLACE %ld\n,ge wei %ld,shi wei %ld,biwei %ld,qian wei %ld,wan wei %ld\n,dao xu %ld,%ld,%ld,%ld,%ld",n,a1,a2,a3,a4,a5,a1,a2,a3,a4,a5);} } } } } }求位数,各位数字,倒序输出。。。倒是能运行,请大家帮忙看看有没有错误
天才第一步,爹地宝贝纸尿裤~