// Program to compute all factorials 1!, 2!, 3!, ... // up to a number input from the keyboard. // // Author: Shawn Havery // Modified: 02-12-08 (Volker Crede) // Creation Date: 02-05-08 // Include stuff #include #include using namespace std; int main() { // Declare variables int N; // to hold argument for max factorial double T = 1; // to hold current factorial // Get input cout << endl << "Enter the number of factorials desired: "; cin >> N; cout << endl; // Generate factorials for (int i = 1; i <= N; i++) { T = T * i; // multiply product by i cout << i << "! = " << T << endl; // output current factorial } }