/* * Program to Find Factorial of a Number */ #include /* Entry point to program */ int main() { unsigned int n, i; unsigned long fact = 1; printf("Enter an integer, (max 12): "); scanf("%d", &n); /* Shows error if the user enters a negative integer */ if (n < 0) printf("Error! Factorial of a negative number doesn't exist."); else { for (i = 1; i <= n; ++i) { fact *= i; } printf("Factorial of %d = %lu", n, fact); } return 0; }