
This one requires a loop that successively multiplies the factors. Starting at 1 was sort of silly, but makes the program very clear:
#include <stdio.h>
main () {
FILE *fin = fopen ("fact.in", "r");
FILE *fout = fopen ("fact.out", "w");
int n, i, f;
fscanf (fin, "%d", &n);
for (f = i = 1; i <= n; i++)
f *= i;
fprintf (fout, "%d\n", f);
exit (0);
}