diff --git a/bin/C12_Recursivite/App.class b/bin/C12_Recursivite/App.class deleted file mode 100644 index 5608f23..0000000 Binary files a/bin/C12_Recursivite/App.class and /dev/null differ diff --git a/bin/Series/S08/S08EX01b.class b/bin/Series/S08/S08EX01b.class new file mode 100644 index 0000000..4082853 Binary files /dev/null and b/bin/Series/S08/S08EX01b.class differ diff --git a/bin/Series/S08/S08EX02a.class b/bin/Series/S08/S08EX02a.class new file mode 100644 index 0000000..6263958 Binary files /dev/null and b/bin/Series/S08/S08EX02a.class differ diff --git a/bin/Series/S08/S08EX02b.class b/bin/Series/S08/S08EX02b.class new file mode 100644 index 0000000..c007a47 Binary files /dev/null and b/bin/Series/S08/S08EX02b.class differ diff --git a/bin/Series/S08/S08EX02c.class b/bin/Series/S08/S08EX02c.class new file mode 100644 index 0000000..3039c8b Binary files /dev/null and b/bin/Series/S08/S08EX02c.class differ diff --git a/bin/Series/S08/S08EX02d.class b/bin/Series/S08/S08EX02d.class new file mode 100644 index 0000000..2436499 Binary files /dev/null and b/bin/Series/S08/S08EX02d.class differ diff --git a/bin/Series/S08/serie8.pdf b/bin/Series/S08/serie8.pdf new file mode 100644 index 0000000..c9feac5 Binary files /dev/null and b/bin/Series/S08/serie8.pdf differ diff --git a/src/C12_Recursivite/App.java b/src/C12_Recursivite/App.java deleted file mode 100644 index c9fc667..0000000 --- a/src/C12_Recursivite/App.java +++ /dev/null @@ -1,7 +0,0 @@ -package C12_Recursivite; - -public class App { - public static void main(String[] args) throws Exception { - System.out.println("Hello, World!"); - } -} diff --git a/src/Series/S08/S08EX01b.java b/src/Series/S08/S08EX01b.java new file mode 100644 index 0000000..256298d --- /dev/null +++ b/src/Series/S08/S08EX01b.java @@ -0,0 +1,14 @@ +package Series.S08; + +public class S08EX01b { + public static void main(String[] args) { + System.out.println("Result: " + f2(6,5)); + } + + static int f2(int x, int y){ + if (x <= 0) return 0; + if (y >= x) return 1 + f2(y,x); + + return 2 + f2(x-3,y-1); + } +} diff --git a/src/Series/S08/S08EX02a.java b/src/Series/S08/S08EX02a.java new file mode 100644 index 0000000..f9f386d --- /dev/null +++ b/src/Series/S08/S08EX02a.java @@ -0,0 +1,14 @@ +package Series.S08; + +public class S08EX02a { + public static void main(String[] args) { + int n = 5; + System.out.println("Factoriel de " + n + " = " + fact(n)); + } + + static long fact(int n){ + if (n <= 1) return 1; + + return n*fact(n-1); + } +} diff --git a/src/Series/S08/S08EX02b.java b/src/Series/S08/S08EX02b.java new file mode 100644 index 0000000..93e6e34 --- /dev/null +++ b/src/Series/S08/S08EX02b.java @@ -0,0 +1,17 @@ +package Series.S08; + +public class S08EX02b { + public static void main(String[] args) { + int x = 2; + int n = 8; + + System.out.println(x + " puissance " + n + " = " + power(x, n)); + } + + static long power(int x, int n){ + if (n <= 0) return 1; + if (n == 1) return x; + + return x * power(x, n-1); + } +} diff --git a/src/Series/S08/S08EX02c.java b/src/Series/S08/S08EX02c.java new file mode 100644 index 0000000..c3b3086 --- /dev/null +++ b/src/Series/S08/S08EX02c.java @@ -0,0 +1,17 @@ +package Series.S08; + +public class S08EX02c { + public static void main(String[] args) { + String dep = "1234"; + System.out.println(dep + " -> " + stringsep(dep)); + } + + static String stringsep(String s){ + if (s == null) return null; + if (s.length() <= 1) return s; + + return "" + s.charAt(0) + ',' + stringsep(s.substring(1)); + } + + +} diff --git a/src/Series/S08/S08EX02d.java b/src/Series/S08/S08EX02d.java new file mode 100644 index 0000000..e1e3504 --- /dev/null +++ b/src/Series/S08/S08EX02d.java @@ -0,0 +1,15 @@ +package Series.S08; + +public class S08EX02d { + public static void main(String[] args) { + char l = 'f'; + System.out.println(l + " -> " + letters(l)); + } + + static String letters(char l){ + if (l == 0) return null; + if (l == 'a') return String.valueOf(l); + + return letters((char)(l-1)) + l; + } +} diff --git a/src/Series/S08/serie8.pdf b/src/Series/S08/serie8.pdf new file mode 100644 index 0000000..c9feac5 Binary files /dev/null and b/src/Series/S08/serie8.pdf differ