public class Main {
    public static int factorialIterativo(int n) {
        int resultado = 1;
        for (int i = 1; i <= n; i++) {
            resultado *= i;
        }
        return resultado;
    }

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

Embed on website

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