Advertisement
noshin98

uva 12459

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