This commit is contained in:
Rémi Heredero 2022-03-30 17:35:04 +02:00
parent 94af13d6d7
commit 53b0996215
14 changed files with 77 additions and 7 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
bin/Series/S08/serie8.pdf Normal file

Binary file not shown.

View File

@ -1,7 +0,0 @@
package C12_Recursivite;
public class App {
public static void main(String[] args) throws Exception {
System.out.println("Hello, World!");
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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);
}
}

View File

@ -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));
}
}

View File

@ -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;
}
}

BIN
src/Series/S08/serie8.pdf Normal file

Binary file not shown.