Multiple choice

What would be the output of the following program? #include<stdio.h> #include<conio.h> int rec(int); int main() { int a=5; int flop; flop=rec(a); printf(answer=%d,flop); getch(); } int rec(int x) { int p; if(x==1) return 1; else { p=x*rec(x-1); return p; }

}

  1. 140

  2. 120

  3. 100

  4. Error in program

  5. None of these

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

Program will find the factorial value of 5, which is 120. Hence, option (2) is correct.