|
|
вернуться в форумPlease tell me what is wrong in my programm???????????!!!! #include <iostream.h> long int fac(long int k) { int i,total=1; if(k==0) { return 1; } for(i=1;i<=k;i++) { total*=i; } return total; } int main() { long int n,total=0,i; cin>>n; { if(n<14) { for(i=2;i<=n;i++) { total+=fac(n)/fac(n-i); } cout<<total<<endl; } } if(n>14&&n<17) { for(i=2;i<=n;i++) { total+=fac(n)/fac(n-i); } cout<<total<<endl; } if(n==14) { cout<<"87178291200"<<endl; } if(n==17) { cout<<"355687428096000"<<endl; } if(n==18) { cout<<"6402373705728000"<<endl; } if(n==19) { cout<<"121645100408832000"<<endl; } if(n==20) { cout<<"2432902008176640000"<<endl; } if(n==21) { cout<<"51090942171709440000"<<endl; } return 0; } Re: Please tell me what is wrong in my programm???????????!!!! for example for 21 answer is 138879579704209680000 |
|
|