// Sam Slee - CPS 006 / Summer 2005
// Math5.java

import cs1.Keyboard;

public class Math5 {
	public static void main(String args[]) {
	
		int iterations;		// number of times we'll run through the loop
		int answer = 1;		// this can easily overflow!
		long answer2 = 1;	// harder to overflow
		double answer3 = 1;	// hardest to overflow, but could loose least significant digits
		
		/*  
			prompting the user for input  
		*/
		System.out.print("Enter the number you want the factorial of, here->");
		iterations = Keyboard.readInt();
		
		/* calculating the answer */
		for(int i = 1; i <= iterations; i++){
			answer = i * answer;
			answer2 = i * answer2;
			answer3 = i * answer3;
		}
		
		// printing out the answer
		System.out.println("The 'int' answer is: "+answer);
		System.out.println("The 'long' answer is: "+answer2);
		System.out.println("The 'double' answer is: "+answer3);
	}
}