Advertisement
LarvitarYoung

FibnocciRecussive

Nov 6th, 2021
89
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 fib(int index){
  3.     if(index==0){return 0;}
  4.     else if (index==1){return 1;}
  5.     else{return fib(index-1)+fib(index-2);}
  6.    
  7. }
  8. void main(int argc, char const *argv[]){
  9.     for(int i=0;i<10;printf("%d ",fib(i)),i++);
  10. }
  11.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement