<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import java.util.Scanner;
//=================================================================================================
public class Factorial {
//-------------------------------------------------------------------------------------------------
    private static final Scanner keyboard = new Scanner(System.in);
//-------------------------------------------------------------------------------------------------
    public static void main(String[] args) {

        int number;
        long factorial;

        System.out.print("What is the number : ");
        number = keyboard.nextInt();

        factorial = computeFactorial(number);
        System.out.println(number + "! = " + factorial);
    }
//-------------------------------------------------------------------------------------------------
//----0th is 0, 1st is 1, 2nd is 1, 3rd is 2, 4th is 3, 5th is 5, 6th is 8, etc.
    private static long computeFactorial(long number) {

        long oneLess;
        long factorialOfOneLess;
        long factorial;

        if (number &lt;= 1) {
            factorial = 1;
        } else {
            oneLess = number - 1;
            factorialOfOneLess = computeFactorial(oneLess);
            factorial = number * factorialOfOneLess;
        }
        return(factorial);
    }
//-------------------------------------------------------------------------------------------------
}
//=================================================================================================
</pre></body></html>