From 5354f292e42f89090a5ec5a901748edf164ae593 Mon Sep 17 00:00:00 2001 From: pzs93xi8q <2927226454@qq.com> Date: Thu, 17 Feb 2022 18:32:10 +0800 Subject: [PATCH] ADD file via upload --- 斐波那契数列.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 斐波那契数列.cpp diff --git a/斐波那契数列.cpp b/斐波那契数列.cpp new file mode 100644 index 0000000..c8c29ed --- /dev/null +++ b/斐波那契数列.cpp @@ -0,0 +1,21 @@ +#include +int Fibon1(int n) +{ + if (n == 1 || n == 2) + { + return 1; + } + else + { + return Fibon1(n - 1) + Fibon1(n - 2); + } +} +int main() +{ + int n = 0; + int ret = 0; + scanf("%d", &n); + ret = Fibon1(n); + printf("ret=%d", ret); + return 0; +}