// FactorialKL.java (c) 2004 Kari Laitinen // http://www.naturalprogramming.com // 2005-03-27 File created. // 2005-03-27 Last modification. import java.util.* ; class FactorialKL { static void print_factorial( int given_integer ) { System.out.print( "\n The factorial of " + given_integer + " is " + given_integer + "! = " ) ; int calculated_factorial = 1 ; while ( given_integer > 1 ) { calculated_factorial = calculated_factorial * given_integer ; System.out.print( given_integer + "*" ) ; given_integer -- ; } System.out.print( "1 = " + calculated_factorial ) ; } public static void main( String[] not_in_use ) { Scanner keyboard = new Scanner( System.in ) ; int integer_from_keyboard ; System.out.print( "\n Type in a positive integer: " ) ; integer_from_keyboard = keyboard.nextInt(); print_factorial( integer_from_keyboard ) ; } }