import cs1.Keyboard; /** Calculate the factorial of an integer n. @author Greg Vogl last modified 2003-09-22 */ public class Factorial { /** Calculate the factorial of an integer n. */ public static void main (String[] args) { System.out.println("Calculate the factorial of an integer n."); // get input System.out.println("Type an integer and press Enter."); int n = Keyboard.readInt(); // calculate statistics long factorial = 1; for (int i=1; i<=n; i++) factorial *= i; // output results System.out.println("The factorial of "+ n + " is " + factorial + "."); } }