Wisdom Materials
Home
About Us
Our Clients
Careers
Services
Education
Jobs
News
Business
Health
Astrology
Entertainment
RealEstate
Devotion
Contact Us
C Programs
/ Fibonacci Series Recursion C Program
Program
Click to the Copy Program
#include
int FibSeries(int); void main() { int num, i = 0; printf("Enter a Number: "); scanf("%d",&num); printf("Fibonacci series: \n"); for ( i = 0 ; i <= num ; i++ ) printf("%d\n", FibSeries(i)); } int FibSeries(int n) { if ( n == 0 ) return 0; else if ( n == 1 ) return 1; else return ( FibSeries(n-1) + FibSeries(n-2) ); }
Input
Enter a Number: 5
Output
Fibonacci series: 0 1 1 2 3 5
Home
Back