Multiple choice

Find the output of the above program or error, if any.

#include<stdio.h>

#include<conio.h>

int num(int);

int main()

{

int n=9,t;

t=num(n);

printf("\\n the result is %d",t);

getch();

}

int num(int m)

{

int f=0;

if(m==0)

return (f);

else

   {

f=f+m+num(m-1);

return (f);

   }

}

  1. The result is 35.

  2. The result is 47.

  3. The result is 45.

  4. The result is 35.

  5. There is error in the program.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The correct answer is 45.