This commit is contained in:
Klagarge committed 2022-03-30 17:35:04 +02:00
1 parent 94af13d6d7
commit 53b0996215
14 files changed
+77 -7

No files matched your search

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-7
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!");
}
}
+14
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);
}
}
+14
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);
}
}
+17
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);
}
}
+17
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));
}
}
+15
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;
}
}
Binary file not shown.