SabirSazzad

Fibonacci Sequence (Using Recurssion)

Feb 20th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.25 KB | None | 0 0
  1. #include<stdio.h>
  2. int recursion(int,int);
  3. int main()
  4. {
  5.     int a=0,b=1;
  6.     recursion(a,b);
  7.  
  8. }
  9.  
  10. int recursion(int a, int b)
  11. {
  12.     int c;
  13.     if(b>35)
  14.     {
  15.         return 0;
  16.     }
  17.     c = a+b;
  18.     printf("%d ",c);
  19.     recursion (b,c);
  20. }
Advertisement
Add Comment
Please, Sign In to add comment