当前位置:网站首页>第一章:递归求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;
}
结果:
边栏推荐
- [optics] dielectric constant calculation based on MATLAB [including Matlab source code 1926]
- Sustainable service business models
- How to build an efficient information warehouse
- EGO Planner代码解析bspline_optimizer部分(2)
- Pecan — Overview
- Thesis study - 7 Very Deep Convolutional Networks for Large-Scale Image Recognition (3/3)
- High concurrency architecture cache
- How does if ($variable) work? [repeat] - how exactly does if ($variable) work? [duplicate]
- Today I am filled with emotion
- Scrape crawler framework
猜你喜欢
Verilog HDL continuous assignment statement, process assignment statement, process continuous assignment statement
Counting from the East and counting from the West will stimulate 100 billion industries. Only storage manufacturers who dare to bite the "hard bone" will have more opportunities
QT -- qfileinfo file information reading
Buuctf's different flags and simplerev
记录在模拟器中运行flutter时报的错
【LeetCode】【SQL】刷题笔记
The necessity of lean production and management in sheet metal industry
Flutter网络和数据存储框架搭建 -b1
Using the visualization results, click to appear the corresponding sentence
I study database at station B (4): DQL
随机推荐
Record the errors reported when running fluent in the simulator
How to design a high concurrency system
Valentine's Day - make an exclusive digital collection for your lover
Basic principle of LSM tree
Work Measurement - 1
QT -- qfileinfo file information reading
Driveseg: dynamic driving scene segmentation data set
我眼中真正优秀的CTO长啥样
High concurrency Architecture - distributed search engine (ES)
cipher
Simulation scheduling problem of SystemVerilog (1)
I didn't cancel
The way to treat feelings
[academic related] how to find the innovation of top papers? Chinese universities won the CVPR Best Student Thesis Award for the first time
I study database at station B (4): DQL
Help change the socket position of PCB part
Does SQL always report foreign key errors when creating tables?
Octopus online ecological chain tour Atocha protocol received near grant worth $50000
01. Preparation for automated office (free guidance, only three steps)
2020 intermediate financial management (escort class)