What will be the output of the following code?
int fun(int n)
{
static int v = 0;
if (n >= 5) return 1;
v=n;
return fun(n+1) + v;
}
int main() {
printf("output is %d", fun(1));
return 0;
}
1
6
2
12
3
11
4
17
What will be the output of the following code?
int fun(int n)
{
static int v = 0;
if (n >= 5) return 1;
v=n;
return fun(n+1) + v;
}
int main() {
printf("output is %d", fun(1));
return 0;
}