//#include "stdafx.h"//If the vc++6.0, with this line.
#include "stdio.h"
int myfact(int n){
if(n==1 || n==0)
return 1;
else return n*myfact(n-1);
}
int main(void){
int N,sum;
while(1){
printf("Input N(0<=N<=100000 letter end)...\nN=");
if(scanf("%d",&N)<=0)
break;
if(N>=0 && N<=100000){
for(sum=0;N;sum+=myfact(N%10),N/=10);
printf("The result is %d.\n",sum);
}
else printf("Error, redo: ");
}
return 0;
}
温馨提示:答案为网友推荐,仅供参考