public class Main {
    public static int factorialRecursivo(int n) {
        if (n == 0)
            return 1;
        else
            return n * factorialRecursivo(n - 1);
    }

    public static void main(String[] args) {
        int numero = 5;
        System.out.println("Factorial recursivo de " + numero + " es: " + factorialRecursivo(numero));
    }
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: