Last active
September 3, 2016 22:18
-
-
Save MaxySpark/f464492b6ffdefadc5827affc09efde3 to your computer and use it in GitHub Desktop.
fibonacci function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int fibo(int n){ | |
if(n==0 || n==1){ | |
return 1; | |
} else { | |
return fibo(n-1)+fibo(n-2); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int fibo(int n){ | |
if(n==0 || n==1){ | |
return 1; | |
} else { | |
return fibo(n-1)+fibo(n-2); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static int fibo(int n){ | |
if(n==0 || n==1){ | |
return 1; | |
} else { | |
return fibo(n-1)+fibo(n-2); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function fibo(n){ | |
if(n==0 || n==1){ | |
return 1; | |
} else { | |
return fibo(n-1)+fibo(n-2); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int fibo(int n){ | |
if(n==0 || n==1){ | |
return 1; | |
} else { | |
return fibo(n-1)+fibo(n-2); | |
} | |
} | |
int main() { | |
int f,fibonum,i; | |
printf("Enter The Range For Finding Fibonacci Series : "); | |
scanf("%d",&f); | |
printf("\nFibonacci Series To Position : %d\n",f); | |
for(i=0;i<f;i++){ | |
fibonum = fibo(i); | |
printf("%d\t",fibonum); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment