- 博客(1)
- 收藏
- 关注
原创 输出斐波那契序列1,1,2,3,5,8,13,……的前25项,要求输出5项,用for语句
#include<stdio.h> main() { int i; long f1,f2,next; f1=f2=1; printf("%8ld%8ld",f1,f2); for(i=3;i<=25;i++) { next=f1+f2; f1=f2; f2=next; printf("%8ld",next); if(i%5==0)printf("\n"); } }
2022-11-16 16:09:46
841
2
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人