/* Calcul de n! par methode recursive           */
/*  - 0! = 1                                    */
/*  - n! = (n-1)!*n                             */

public class FactorielRecursifEnConsole {

/////////////////////////////////////////////////

/* Calcul de n! par methode recursive           */
/*  - 0! = 1                                    */
/*  - n! = (n-1)!*n                             */

  static long factoriel(int n) {
    long res;
    if ( n == 0 ) {
      res = 1; }
      else {
      res = factoriel(n-1)*n; }
    return res;
  }

/////////////////////////////////////////////////

/* Programme principal                         */

  public static void main(String [] args) {
    Console.setTitle("FactorielRecursif");
    int n;
    long factn;
    Console.afficher("Valeur ? ");
    n = Console.saisirInt();
    factn = factoriel(n);
    Console.afficherln(n,"! = ",factn);
  }
}