Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int fibn(int n);
- int main()
- {
- int i, n;
- printf("Enter the number of items to show in fibonacci series: ");
- scanf("%d", &n);
- printf("The fibonacci series is: \n");
- for(i = 0; i < n;i++)
- printf("%d \n", fibn(i));
- }
- int fibn(int n)
- {
- if (n==0)
- return 0;
- else if (n==1)
- return 1;
- else
- return fibn(n-1)+fibn(n-2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement