A

Admin • 833K Points
Coach

Q. What will be the output of the following code snippet?

Code:
#include <stdio.h>
int get(int n) {
if(n <= 1) {
return n;
}
return get(n - 1) + get(n - 2);
}
void solve() {
int ans = get(6);
printf("%d", ans);
}
int main() {
solve();
return 0;
}
  • (A) 5
  • (B) 1
  • (C) 0
  • (D) 8
  • Correct Answer - Option(D)
  • Views: 16
  • Filed under category C Programming
  • Hashtags:

No solution found for this question.
Add Solution and get +2 points.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.