public class Exercicio4 {
public static void main(String[] args) {
// for(int i =1, fatorial =1; i<=10; i++) {
// fatorial *=i;
// System.out.println("O valor do fatorial "+i+"! é:"+fatorial);
// }
int fatorial =1;
for(int n=1;n<=10;n++) {
fatorial *=n;
System.out.println(fatorial);
}
}
}
public class Exercicio4 {
public static void main(String[] args) {
for (int n = 1; n <= 10; n++) {
System.out.println(fatorial(n));
}
}
public static long fatorial(int n) {
if (n <= 1) {
return 1;
} else {
return n * fatorial(n - 1);
}
}
}