Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

TestaFatorial - solução

Demorei para entender que o novo fatorial (total) e meu total anterior* novo numero n.


public class TestaFatorial {
    public static void main(String[] args) {
        int total=1;
        for (int n = 1; n <= 10; n++) {
            total = total*n;
            System.out.println(" total="+ total);
        }
        System.out.println(" Fatorial 10="+ total);


    }
}

Matricule-se agora e aproveite até 50% OFF

O maior desconto do ano para você evoluir com a maior escola de tecnologia

QUERO APROVEITAR
1 resposta
solução!

Perfeito James

class Fatorial {
    public static void main(String[] args) {
        int fatorial = 1;
        for (int i = 1; i < 11; i++) {
            fatorial *= i;
            System.out.println("Fatorial de " + i + " = " +fatorial);
        }
    }
}