extras: add P16-P23, P25

Signed-off-by: Amneesh Singh <natto@weirdnatto.in>
This commit is contained in:
2023-06-07 03:37:31 +05:30
parent 14898356a8
commit cc83093210
9 changed files with 153 additions and 0 deletions

14
P20.java Normal file
View File

@@ -0,0 +1,14 @@
public class P20 {
public static void main(String[] args) {
int n = 10;
System.out.print("Fibonacci Series of length " + n + ": ");
fibonacci(0, 1, n);
}
public static void fibonacci(int a, int b, int n) {
if (n == 0)
return;
System.out.print(a + " ");
fibonacci(b, a + b, n - 1);
}
}