#include <stdio.h>

/* Terry Harvey CISC105 Section 21 TA Aaron*/

/* 
 * Sample program for class. Calculates the factorial of an input
 * integer. Be careful, as factorials get very large very fast! Can
 * you write this program without looking at this file?
 */

/* Computes the factorial of limit */
int fact(int limit);

int main(){
    int input;

    printf("Enter an integer: ");
    scanf("%d", &input);
    printf("%d\n", fact(input));
    return 0;
}

/* Computes the factorial of limit */
int fact(int limit){
    int i, 
        result = 1;
    for (i = 1; i < (limit + 1); i++){
        result = result * i;
    }

    return result;
}
