#include<stdio.h> int main(){ int m; while(scanf("%d",&m)!=EOF){ if(m==0) break; else{ long long int i,temp,a=1,b=0,sum; for(i=0;i<m;i++){ if(i==0) temp=0; else temp=a; a=b+a; b=temp; sum=a+b; } printf("%lld\n",sum); } } } |
Double click to view unformatted code.