Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- int main()
- {
- int n,a,b,i;
- long long c;
- while(scanf("%lld",&n)!=EOF)
- {
- a=0;
- b=1;
- for(i=1;i<=n;i++)
- {
- c=a+b;
- b=a;
- a=c;
- }
- printf("The Fibonacci number for %d is %lld\n",n,c);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement