Created
September 1, 2016 07:55
-
-
Save rabiulcste/11109de5cf07e11ae739488498facc1f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <bits//stdc++.h> | |
using namespace std; | |
int a[10000]; | |
int m, n, x, temp, sum, i, j; | |
int main() | |
{ | |
while(scanf("%d", &n)==1){ | |
a[0] = 1; | |
m = 1; | |
sum = 0; | |
temp = 0; | |
for(i=1; i<=n; i++) { | |
for(j=0; j<m; j++) { | |
x = a[j]*i+temp; a[j] = x%10; temp = x/10; | |
} | |
while(temp>0) { | |
a[m] = temp%10; | |
temp = temp/10; | |
m++; | |
} | |
} | |
a[m] = '\0'; | |
for(j=m-1; j>=0; j--){ | |
printf("%d", a[j]); | |
} | |
printf("\n"); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment