SHARE
TWEET

Fibonacci




Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- #include<stdio.h>
- int fibo(int);
- int main()
- {
- int n,a=0,j;
- scanf("%d",&n);
- for(j=1; j<=n; j++)
- {
- printf("%d",fibo(a));
- a++;
- }
- return 0;
- }
- int fibo(int n)
- {
- if(n==0)
- return 0;
- else if(n==1)
- return 1;
- else
- return (fibo(n-1)+fibo(n-2));
- }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.