开通VIP,畅享免费电子书等14项超值服
首页
好书
留言交流
下载APP
联系客服
2018.06.26
求斐波那契数列前20项
源码:
#include “stdio.h'
#include 'stdlib.h'
long int f();
main()
{
int i;
for(i=1; i<=20;>=20;>
printf('f(%d)=%ld\n',i,f());
}
long int f()
static long int f0=-1,f1=1,f2;
f2 = f0+f1;
f0 = f1;
f1 = f2;
return f2;
微信登录中...请勿关闭此页面