30 lines
767 B
Java
30 lines
767 B
Java
public class Appels {
|
|
|
|
public static int indentation;
|
|
|
|
public static long fact(long n){
|
|
for (int i = 0; i < indentation; i++) {
|
|
System.out.print(" ");
|
|
}
|
|
System.out.println("Argument début: "+n);
|
|
indentation++;
|
|
if(n==1l){
|
|
//Thread.dumpStack();
|
|
return 1;
|
|
}else{
|
|
long r=n*fact(n-1l);
|
|
for (int i = 0; i < indentation-1; i++) {
|
|
System.out.print(" ");
|
|
}
|
|
indentation--;
|
|
System.out.println("Argument fin: "+r);
|
|
return r;
|
|
}
|
|
}
|
|
|
|
public static void main(String args[]){
|
|
long x=Long.parseLong(args[0]);
|
|
indentation=0;
|
|
System.out.println(x+"! = "+fact(x));
|
|
}
|
|
} |