用for()或while()循环均可实现。
本代码while()
/*初学C语言,有不足还请指正*/
#include<stdio.h>
#include"math.h"
#include"conio.h"
int main() // 斐波那契数列
{
float a = 1;
float b = 1;
float c = 0;
int i = 0;
while (a < 1e17) //当数值大于10^17时跳出循环
{
printf("%21.0f\t", a);
printf("%21.0f\t", b);
c = a + b;
printf("%21.0f\t", c);
a = b + c;
b = a + c;
}
}