+ 1

Get answer

#include <stdio.h> int fun(int n) { if (n==0){ return 1; { else return 7+f(n-2); } int main() { printf ("%d",fun(4)); return 0; }

7th Jun 2020, 6:31 AM
Ujjwal Singh Rajput
Ujjwal Singh Rajput - avatar
2 Respuestas
+ 3
So func(4) returns 7+f(n-2) first time , Then in 7+f(4-2) f(2) is called so it returns 7+f(2-2) again now f(0) is called but since n==0 1 is returned and recursion ends with 7+7+1
7th Jun 2020, 6:41 AM
Abhay
Abhay - avatar
0
Answer is 4 7 15 12 Choose the correct option
7th Jun 2020, 6:32 AM
Ujjwal Singh Rajput
Ujjwal Singh Rajput - avatar