From cecaa44373a28d8a1eabcbd0bb03b5333c18ceee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E5=B9=B3=E7=A7=91?= <2540601270@qq.com> Date: Sat, 28 Oct 2023 19:35:28 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=92=E5=BD=92=E7=AE=97=E6=B3=95=E8=AE=A1?= =?UTF-8?q?=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 递归算法计算 n!.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 递归算法计算 n!.cpp diff --git a/递归算法计算 n!.cpp b/递归算法计算 n!.cpp new file mode 100644 index 0000000..fcca738 --- /dev/null +++ b/递归算法计算 n!.cpp @@ -0,0 +1,19 @@ +#include +int N(int n) +{ + if(n<=1) + return 1; + else + return N(n-1)*n;//ؼ˼ +} +int main() +{ + int n=0; + int ret=0; + printf("Ҫ׳˵"); + scanf("%d",&n); + ret=N(n); + printf("%dĽ׳%d\n",n,ret); + return 0; + +}