#include <stdio.h>
#include <malloc.h>
#include <string.h>
#define max 128 //定义存储字符串的最大长度
#define num 500 //定义求Fibonacci数列个数
void char_add(char* a,char* b,char* c)
{
int ia[max]={0};
int ib[max]={0};
int ic[max]={0};
int flag=0,flag2=0;
int i,j;
for(i=0;i<max;i++)
{
if(a[i]=='\0') ia[i]=0; else ia[i]=a[i]-'0';
if(b[i]=='\0') ib[i]=0; else ib[i]=b[i]-'0';
}
for(i=max-1;i>=0;i--)
{
ic[i]=ia[i]+ib[i]+flag;
if(ic[i]>9) {flag=1;ic[i]-=10;} else flag=0;
}
for(j=0;j<max;j++) {c[j]=ic[j]+'0';}
c[j]='\0';
}
int main()
{
char a[max]={'\0'};
char b[max]={'\0'};
char c[max]={'\0'};
char* output[num];
int i,j,k,m;
a[max-1]='1';output[0]="1";
b[max-1]='1';output[1]="1";
j=2;
while(j<num)
{
char_add(a,b,c);
for(k=0;k<max;k++) if(c[k]>'0') break;
strcpy(output[j]=&c[k];
for(i=0;i<max;i++)
{
a[i]=b[i];
b[i]=c[i];
}
printf("%s\n",output[j]);
j++;
}
return 0;
}