adding recursion review question
This commit is contained in:
@@ -14,8 +14,11 @@ What is the value of fun(2)?
|
||||
|
||||
```cpp
|
||||
int fun(int n) {
|
||||
if (n == 4) return n;
|
||||
else return 2*fun(n+1);
|
||||
if (n == 4){
|
||||
return n;
|
||||
} else {
|
||||
return 2 * fun(n+1);
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user