"Write a C++ program to find the nth Fibonacci number using recursion.
- User
"Write a C++ program to find the nth Fibonacci number using recursion.
Assistant
#include
using namespace std;
int fibonacci(int n) { if (n == 0) return 0; if (n == 1) return 1; return fibonacci(n - 1) + fibonacci(n - 2); }
int main() { int n = 10; cout << "n " << n << " th Fibonacci Number is " << fibonacci(n) << endl; return 0; }
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.