C Programming Code Examples C > Functions Code Examples C program to generate nth fibonacci term using recursion C program to generate nth fibonacci term using recursion Write a recursive function to generate nth fibonacci term in C programming. How to generate nth fibonacci term in C programming using recursion. Declare recursive function to find nth Fibonacci term Assign a meaningful name to the function, say fibo(). The function accepts an integer hence update function declaration to fibo(int x). Finally the function must return the nth Fibonacci term which is an integer. Hence, return type of the function should be unsigned long long. Function declaration to find nth Fibonacci term is - unsigned long long fibo(int x); #include <stdio.h> /* Function declaration */ unsigned long long fibo(int x); int main() { int x; unsigned long long fibonacci; /* Input a number from user */ printf("Enter any number to find nth fiboacci term: "); scanf("%d", &x); fibonacci = fibo(x); printf("%d fibonacci term is %llu", x, fibonacci); return 0; } /* Recursive function to find nth Fibonacci term */ unsigned long long fibo(int x) { if(x == 0) //Base condition return 0; else if(x == 1) //Base condition return 1; else return fibo(x-1) + fibo(x-2); }