//Program to calculate factorials
#include <stdio.h>

int factorial(int);  /* Function recursively calculates a factorial*/


int main(int argc, char **argv)

{
    int n;   // n is the number we will find the factorial of.
    if (scanf ("%d", &n) != 1) {
        printf ("Read error!\n");
        return -1;
    }
    printf ("The factorial of %d is %d\n",n, factorial(n));
    return 0;

}

int factorial (int n)
/* Recursively return the factorial of n */
{
    if (n == 1)
	return 1;
    return (n* factorial (n-1));
} 

