/** * Appels */ public class Appels { private static int factorielle(int n, int indent) { for (int i = 0; i < indent; i++) System.out.print(" "); System.out.println("input: "+ n); int res; switch (n) { case 0: res = 0; break; case 1: res = 1; break; default: res = n * factorielle(n-1, indent+1); break; } for (int i = 0; i < indent; i++) System.out.print(" "); System.out.println("output: " + res); return res; } public static void main(String[] args) { System.out.println(factorielle(7, 0)); } }