// Homework #? // Problem 2.45 // The factorial function is used frequently in probability problems. The // factorial of a positive integer n (written n! and pronounced "n factorial" // is equal to the product of the positive integers from 1 to n. Write a // program that evaluates the factorials of the integers from 1 to 5. Print // the results in tabular format. What difficulty might prevent you from // calculating the factorial of 20? #include main() { int factorial; cout << "X\tFactorial of X\n"; for( int i=1; i<=5; i++) { factorial = 1; for (int j=1; j<=i; j++) { factorial *=j; } cout << i << '\t' << factorial << endl; } return 0; } // Output for Problem 2.45 X Factorial of X 1 1 2 2 3 6 4 24 5 120