fixed page 4 task 5 iterative function
This commit is contained in:
parent
5698534b55
commit
39db3138b3
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue