diff --git a/DEV.3.2/TP/TP2-Recursivite/Fibonacci.java b/DEV.3.2/TP/TP2-Recursivite/Fibonacci.java new file mode 100644 index 0000000..7b88c61 --- /dev/null +++ b/DEV.3.2/TP/TP2-Recursivite/Fibonacci.java @@ -0,0 +1,15 @@ +public class Fibonacci { + public Fibonacci() { + + } + + public int form(int val) { + if(val == 0) { + return 0; + } else if(val == 1) { + return 1; + } else { + return form(val -1) + form(val -2); + } + } +} \ No newline at end of file diff --git a/DEV.3.2/TP/TP2-Recursivite/ex1-Appels/Appels.class b/DEV.3.2/TP/TP2-Recursivite/ex1-Appels/Appels.class new file mode 100644 index 0000000..d706082 Binary files /dev/null and b/DEV.3.2/TP/TP2-Recursivite/ex1-Appels/Appels.class differ diff --git a/DEV.3.2/TP/TP2-Recursivite/ex1-Appels/Appels.java b/DEV.3.2/TP/TP2-Recursivite/ex1-Appels/Appels.java new file mode 100644 index 0000000..885eaa2 --- /dev/null +++ b/DEV.3.2/TP/TP2-Recursivite/ex1-Appels/Appels.java @@ -0,0 +1,23 @@ +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])); + } +} \ No newline at end of file diff --git a/DEV.3.2/TP/TP2-Recursivite/ex2-Tableaux/Tableaux.java b/DEV.3.2/TP/TP2-Recursivite/ex2-Tableaux/Tableaux.java new file mode 100644 index 0000000..3644304 --- /dev/null +++ b/DEV.3.2/TP/TP2-Recursivite/ex2-Tableaux/Tableaux.java @@ -0,0 +1,5 @@ +public class Tableaux { + public Tableaux() { + + } +} \ No newline at end of file