daily pastebin goal
11%
SHARE
TWEET

Fibonacci

a guest Jan 20th, 2019 54 in 148 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2. int fibo(int);
  3. int main()
  4. {
  5.     int n,a=0,j;
  6.     scanf("%d",&n);
  7.     for(j=1; j<=n; j++)
  8. {
  9.     printf("%d",fibo(a));
  10.     a++;
  11. }
  12. return 0;
  13. }
  14. int fibo(int n)
  15. {
  16.     if(n==0)
  17.         return 0;
  18.      else if(n==1)
  19.         return 1;
  20.     else
  21.         return (fibo(n-1)+fibo(n-2));
  22.  
  23. }
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. OK, I Understand
 
Top