Advertisement
noshin98

uva 495

Jul 14th, 2016
346
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.34 KB | None | 0 0
  1. #include<stdio.h>
  2. int main()
  3. {
  4.     int n,a,b,i;
  5.     long long c;
  6.     while(scanf("%lld",&n)!=EOF)
  7.     {
  8.         a=0;
  9.         b=1;
  10.  
  11.         for(i=1;i<=n;i++)
  12.         {
  13.  
  14.  
  15.                 c=a+b;
  16.                 b=a;
  17.                 a=c;
  18.  
  19.         }
  20.         printf("The Fibonacci number for %d is %lld\n",n,c);
  21.     }
  22.     return 0;
  23.  
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement