阶乘的和

 1 #include <iostream>
2 using namespace std;
3 int main()
4 {int jc(int);
5
6 int a,b,c;
7 cin>>a>>b>>c;
8 cout<<a<<"!+"<<b<<"!+"<<c<<"!="<<jc(a)+jc(b)+jc(c)<<endl;
9
10 return 0;
11 }
12
13
14
15 int jc(int n)
16 { int j;
17 if(n==0||n==1)j=1;
18 else j=n*jc(n-1);
19 return j;
20
21 }

2 3 5
2!+3!+5!=128
Press any key to continue

posted @ 2011-11-24 18:57  贰百舞  阅读(128)  评论(0编辑  收藏  举报