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; + +}