48 lines
469 B
Java
48 lines
469 B
Java
import java.io.*;
|
|
import java.lang.Thread;
|
|
|
|
public class Appels {
|
|
|
|
|
|
public static int Factorielle (int n){
|
|
|
|
Thread.dumpStack();
|
|
|
|
if(n==0){
|
|
|
|
|
|
return 1;
|
|
}
|
|
else {
|
|
|
|
return n*Factorielle(n-1);
|
|
|
|
}
|
|
|
|
/*System.out.println()
|
|
*/
|
|
|
|
}
|
|
|
|
public static void main(String[] args){
|
|
|
|
|
|
|
|
if(args.length != 1){
|
|
|
|
System.out.println("Usage : java Appel <entier>");
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
int n = Integer.parseInt(args[0]);
|
|
|
|
int resultat = Factorielle(n);
|
|
|
|
System.out.println(n+"! = " + resultat);
|
|
|
|
}
|
|
|
|
|
|
} |