import java.util.*; import java.io.*; public class factorial_recursive { public static void main(String[] args) throws IOException { BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in)); System.out.print("Enter max. value: "); String maxStr = stdin.readLine(); int max = Integer.parseInt(maxStr); System.out.println("Factorial of " + max + " = " + fact(max)); } public static double fact(int n) { if (n == 1) return 1.0; else return (n * fact(n-1)); } }