/* * bigf: Calculates "big" factorials. * Copyright (C) 1997 Amit Singh. All Rights Reserved. */ int t[131068], f = 0, l = 0; void F(int *t, int i) { int g, z = l, c = 0; while (z <= f) { g = t[z] * i + c; t[z] = g % 10; c = g / 10; z = z + 1; } if (c != 0) { f = f + 1; t[f] = c; } } void main(int a, char **r) { int n, i, k; t[l] = 1; n = atoi(r[1]); for (i = 1; i <= n; i++) F(t, i); for (i = f; i >= l; --i) printf("%u", t[i]); printf ("\n"); }