23 lines
428 B
Java
23 lines
428 B
Java
public class Appels {
|
|
|
|
public Appels(int val) {
|
|
int indentation = 0;
|
|
fact(val, indentation);
|
|
}
|
|
|
|
public int fact(int nb, int indentation) {
|
|
if(nb > 0) {
|
|
System.out.println(" ");
|
|
return nb*fact(nb-1,indentation++);
|
|
} else {
|
|
Thread.dumpStack();
|
|
return 1;
|
|
}
|
|
System.out.println(nb+"! = "+fact(nb, indentation));
|
|
|
|
}
|
|
|
|
public static void main(String[] args) {
|
|
new Appels(Integer.parseInt(args[0]));
|
|
}
|
|
} |