求写一个简单的c语言代码,要最简单的那种。谢谢

如题所述

//#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;
}

温馨提示:答案为网友推荐,仅供参考
第1个回答  2015-11-02
题目截图都不全。给我看下题目意思啊追问

追答

楼主, 我去你那个网站AC过了。楼上答案明显是错的。为什么会采纳他的?代码删了不给你了。

相似回答