Advertisement
noshin98

uva 900

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