/* Moderately Big Factorials; version 1.0 */
/* (c) Ian Hickson 2000, distributed under the GNU GPL */
main() {
/* Declare variables: */
unsigned long long int n, index;
long double result = 1.0;
/* ... result is floating point because it would overflow integer types */
/* Introduce program: */
printf("Welcome to the Moderately Big Factorials program, version 1.0\n");
printf("This program was written and is (c) copyright 2000 by Ian Hickson.\n");
printf("It is covered by the GNU General Public Licence.\n\n");
/* Get number of which to find factorial: */
printf("Please enter an integer in the range 0 to 1754: ");
scanf("%llu", &n);
/* ... "llu" means "expect unsigned long long int" */
/* Perform factorial by multiplying 'result' by itself
and every number from 2 to n sequentially: */
for (index = 1; index < n; result *= ++index);
/* Print output: */
printf("\n%llu! = %Lg\n", n, result);
/* ... "Lg" means "expect long double and print it nicely" */
}