当前位置:网站首页>第一章:递归求n的阶乘n!
第一章:递归求n的阶乘n!
2022-07-03 19:17:00 【股_四】
long fac1(int n)
{
long f;
if (n == 1) f = 1;
else f = n * fac1(n - 1);
return (f);
}
int main()
{
int n;
long y;
printf(" 请输入n(n < 13):");
scanf("%d", &n);
if (n > 12)
{
printf(" 输入的n超出上限12,请重新输入n。\n");
return 0;
}
y = fac1(n);
printf(" %d! = %ld\n", n, y);
return 0;
}
结果:
边栏推荐
- [leetcode weekly race] game 300 - 6110 Number of incremental paths in the grid graph - difficult
- Summary of composition materials for 2020 high-frequency examination center of educational resources
- 01. Preparation for automated office (free guidance, only three steps)
- Day18 - basis of interface testing
- 论文阅读 GloDyNE Global Topology Preserving Dynamic Network Embedding
- Ego planner code parsing Bspline_ Optimizer section (1)
- C enum contains value - C enum contains value
- Octopus online ecological chain tour Atocha protocol received near grant worth $50000
- Succession of flutter
- Dynamic planning -- expansion topics
猜你喜欢
Record: writing MySQL commands
Record the errors reported when running fluent in the simulator
EGO Planner代码解析bspline_optimizer部分(3)
[disease identification] machine vision lung cancer detection system based on Matlab GUI [including Matlab source code 1922]
【LeetCode】【SQL】刷题笔记
Does SQL always report foreign key errors when creating tables?
Thesis study - 7 Very Deep Convolutional Networks for Large-Scale Image Recognition (3/3)
Record: MySQL changes the time zone
Analysis of dart JSON encoder and decoder
BUUCTF
随机推荐
We have built an intelligent retail settlement platform
DriveSeg:动态驾驶场景分割数据集
Record the errors reported when running fluent in the simulator
Redis master-slave synchronization, clustering, persistence
Day_ 18 IO stream system
Yolov3 network model building
Dynamic planning -- expansion topics
I didn't cancel
BUUCTF
Flask generates swagger documents
Why should the gradient be manually cleared before back propagation in pytorch?
【数学建模】基于matlab船舶三自由度MMG模型【含Matlab源码 1925期】
“google is not defined” when using Google Maps V3 in Firefox remotely
Integrated easy to pay secondary domain name distribution system
利用可视化结果,点击出现对应的句子
EGO Planner代碼解析bspline_optimizer部分(1)
Latex image rotates with title
The space of C disk is insufficient, and the computer becomes stuck. Quickly expand the capacity of C disk to make the system more smooth
math_泰勒公式
KINGS