#include <stdio.h>

/* This is the declaration (or prototype) for the function factorial.   */
int Factorial(int n);                                        /* -- A -- */


/* The function main --- all C programs must contain a function main    */
main()
{
  int number;                    /* Number from user                    */
  int answer;                    /* Answer calculated by factorial      */
  
  printf("Input a number: ");    /* Function call to a library function */
                                 /* -- where is its prototype?          */
  scanf("%d", &number);          /* Function call to a library function */

  answer = Factorial(number);    /* Function call to factorial  -- B -- */

  printf("The factorial of %d is %d\n", number, answer);  /* Output     */
}

/* The function definition for factorial.                       -- C -- */
int Factorial(int n)
{
  int i;                         /* Iteration count                     */
  int result = 1;                /* Initialized result                  */
  
  for (i = 1; i <= n; i++)       /* This loop calculates factorial      */
    result = result * i;
  
  return result;                 /* Return to caller            -- D -- */
}