Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main()
- {
- int nextTerm = 0, n,n2;
- printf("Enter a positive number: ");
- scanf("%d %d", &n,&n2);
- int t1 = n, t2 =n + 1;
- printf("Fibonacci Series: %d %d ", t1, t2);
- nextTerm = t1 + t2;
- while(nextTerm <= n2)
- {
- printf("%d ",nextTerm);
- t1 = t2;
- t2 = nextTerm;
- nextTerm = t1 + t2;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement