From bbc6b70984f7174d336c18364e96797b1fc90b53 Mon Sep 17 00:00:00 2001 From: pfka9ogtp <2376896771@qq.com> Date: Sat, 19 Feb 2022 16:47:50 +0800 Subject: [PATCH] ADD file via upload --- 3.斐波那契数列.cpp | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 3.斐波那契数列.cpp diff --git a/3.斐波那契数列.cpp b/3.斐波那契数列.cpp new file mode 100644 index 0000000..2df5c20 --- /dev/null +++ b/3.斐波那契数列.cpp @@ -0,0 +1,29 @@ +#include +void fib(int n) +{ +int i,a,b,c; +for(i=0;i1) +{ + c=a+b; + printf("%d ",c); + a=b; + b=c; +} +else +{ + a=1; + b=1; + printf("1 "); +} +} +} + +int main(void) +{ +int i; +scanf("%d",&i); +fib(i); +return 1; +}