Skip to content

Commit 911d0e3

Browse files
authored
Create FCTRL2.cpp
1 parent e325ea2 commit 911d0e3

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

Codeshef/FCTRL2.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include <iostream>
2+
using namespace std;
3+
4+
int main(){
5+
int T;
6+
cin>>T;
7+
while(T--){
8+
int n;
9+
cin>>n;
10+
11+
int a[200],carry=0,temp,m=0;
12+
13+
for(int i=0;i<200;i++)a[i]=0;
14+
15+
a[0]=1;
16+
17+
for(int i=2;i<=n;i++){
18+
19+
for(int j=0;j<=m;j++){
20+
temp = (i*a[j])+carry;
21+
carry = temp/10;
22+
a[j]=temp%10;
23+
if(carry!=0 && j==m){
24+
m++;
25+
}
26+
}
27+
}
28+
29+
for(int i=m;i>=0;i--)cout<<a[i];
30+
cout<<endl;
31+
}
32+
33+
34+
return 0;
35+
}

0 commit comments

Comments
 (0)