C output type question

Q.  C Programming : Consider the following program

int n(int i)
{
     static int a=0;
     if(i<=0) return 1;
     if (i>3)
     {
          a=i;
return n(i-2)+2;
                }
               return n (i-1)+a;
           }
             What is the value of f(5)?

- Published on 16 Jun 15

a. 5
b. 10
c. 12
d. 18

ANSWER: 18

Post your comment / Share knowledge


Enter the code shown above:

(Note: If you cannot read the numbers in the above image, reload the page to generate a new one.)