斐波那契数列:2.数组
#include <stdio.h>
int fib(int m)
{
int i;
int a[100]={0,1,1};
for(i=2;i<=m;i++)
{
a[i]=a[i-1]+a[i-2];
}
return a[m];
}
int main()
{
int n;
scanf("%d",&n);
printf("%d",fib(n));
return 0;
}
标签:fib,数列,int,斐波,数组,那契
From: https://www.cnblogs.com/yesiming/p/17441647.html