Skip to content

Instantly share code, notes, and snippets.

@rabiulcste
Created September 1, 2016 07:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rabiulcste/11109de5cf07e11ae739488498facc1f to your computer and use it in GitHub Desktop.
Save rabiulcste/11109de5cf07e11ae739488498facc1f to your computer and use it in GitHub Desktop.
#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