Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int c=0,n,res;
- scanf("%d",&n);
- res=fibo(n);
- while(c<n)
- {
- printf("%d ",fibo(c));
- c++;
- }
- return 0;
- }
- int fibo(int n)
- {
- if(n==0 || n==1)
- {
- return n;
- }
- else
- {
- return (fibo(n-1)+fibo(n-2));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment