Skip to content

Commit

Permalink
added fibonacci series with recursion
Browse files Browse the repository at this point in the history
  • Loading branch information
ssj1901 committed Oct 3, 2020
1 parent 4d23495 commit eb4cb48
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions C/fibrecur.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include<stdio.h>
int fib(int n)
{
if(n <= 1)
return n;
else
return(fib(n-1) + fib(n-2));
}


void main()
{
int n,i;
printf("Enter Total terms: ");
scanf("%d", &n);
printf("Fibonacci series of %d terms are: \n",n);
for(i = 0; i < n; i++)
{
printf("%d ", fib(i));
}
}

0 comments on commit eb4cb48

Please sign in to comment.