programming9
  • Flowcharts
  • Programs
      • Back
      • C Programs
      • C++ Programs
      • Java Programs
      • Python Codes
      • HTML Codes
      • Java Script Codes
      • SQL Codes
  • Tutorials
      • Back
      • Java Tutorials
      • Competitive Programming
      • Python Tutorials
      • C Programming
  • Blog
  • Login

C Program to Find Nth Fibonacci Number Using Recursion

Details
Written by: Rama Boya
Category: C Programs
#include<stdio.h>
int fib (int);
int main ()
{
  int n, result;
  printf ("Enter the Nth Number: ");
  scanf ("%d", &n);
  result = fib (n);
  printf ("The %dth number in Fibonacci series is %d\n", n, result);
  return 0;
}

/* function for  recursive fibonocci call */
int fib (int n)
{
  if (n == 0)
    {
      return 0;
    }
  else if (n == 1)
    {
      return 1;
    }
  else
    {
      return (fib (n - 1) + fib (n - 2));
    }
}

 

OUTPUT:

Enter the Nth Number: 8                                                                                                                 
The 8th number in Fibonacci series is 21   
Previous article: GCD of Two Numbers Without using LCM in C Prev Next article: C Program for Multiplication Table using Goto Statement Next
  • C Program to Design Lexical Analyzer
  • C Program to Find Roots of a Quadratic Equation
  • C Program to Find Sub String Position in Given String
  • C Program to Implement Structure with Array
  • Find Two's Complement of a Binary Number Using C programming
  • C Program to Find Second Largest Number in an Array
  • C Program to Find Address locations of Array Elements Using Pointers
  • C Program for Fibonacci Series Using for Loop
  • C program to Convert Number to Words
  • C Program to convert Celsius to Fahrenheit
  • C Program to Find Reverse of a Number using Recursion
  • C Program to Implement Circular Linked List
  • C Program to Find Given Number is Armstrong or Not
  • C Program to Print Pascal Traingle
  • C Program to Solve Tower of Hanoi Problem Using Recursive and Non-Recursive
  • Privacy Policy
  • Cookie Policy
© programming9.com 2025
Back to top