package algorithmsample31;
import java.util.Scanner;
/**
*
* @author Nurhak
*/
public class AlgorithmSample31 {
public static void main(String[] args) {
String data = "";
int number = 0;
int factorial = 0;
try {
Scanner scan = new Scanner(System.in);
System.out.println("Enter the factorial fuction result please:");
data = scan.nextLine();
factorial = Integer.parseInt(data);
number = factorial;
for (int i = 1; i <= (factorial - 1); i++) {
factorial = factorial / i;
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(number + " equals to " + factorial + " !");
}
}
Comments
Post a Comment