Skip to content

Commit

Permalink
Fibonacci in C
Browse files Browse the repository at this point in the history
  • Loading branch information
saggu10417 committed Oct 27, 2018
1 parent d47883e commit d372f5a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Binary file added a.out
Binary file not shown.
18 changes: 18 additions & 0 deletions fibonacci.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include<stdio.h>
int fib(int n)
{
if (n <= 1)
return n;
return fib(n-1) + fib(n-2);
}

int main ()
{
int n ;
printf("Enter value of n:");
scanf("%d",&n);
printf("%d", fib(n));
getchar();
return 0;
}

0 comments on commit d372f5a

Please sign in to comment.