Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Create fibonacci.c
  • Loading branch information
doa14001 committed Mar 26, 2019
1 parent 53a1061 commit 285c2f5
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions fibonacci.c
@@ -0,0 +1,25 @@
#include <stdio.h>


int fibonacci(int n)
{


if(n==0) return 0;
if(n==1) return 1;
return fibonacci(n - 1) + fibonacci(n - 2);

}


int main(void)
{

int n;
printf("Enter a number between 1 and 10:");
scanf("%d",&n);
printf("Fibonacci(n)=%d\n",fibonacci(n));



}

0 comments on commit 285c2f5

Please sign in to comment.