fixed page 4 task 5 iterative function

This commit is contained in:
Sven Vogel 2023-05-10 17:18:52 +02:00
parent 5698534b55
commit 39db3138b3
1 changed files with 2 additions and 2 deletions

View File

@ -33,7 +33,7 @@ public class Aufgabe5 {
return 2;
}
return 4 * recursiveFunction(n - 2);
return 4 * recursiveFunction(n - 2) - 1;
}
/**
@ -50,7 +50,7 @@ public class Aufgabe5 {
int sum = 1;
for (int i = 2; i < n; i += 2) {
sum *= 4;
sum = sum * 4 - 1;
}
return sum;