当前位置:网站首页>Enter n to automatically calculate factorial sum
Enter n to automatically calculate factorial sum
2022-07-21 23:30:00 【Chinese a man】
#include<stdio.h>
long fact(long a);
int main()
{
long n,result=0;
long i;
scanf("%ld",&n);
for(i=1;i<=n;i++)
{
/****** Add a few lines of code here to start ******/
result+=fact(i);
/****** Add several lines of code here to end ******/
}
printf("1!+2!+...+n!=%ld",result);
}
/****** The definition here is fact Function to ******/
long fact(long a){
if(a==1||a==0)
return 1;
else
return a*fact(a-1);
}
/****** The definition here is fact End of the function ******/
边栏推荐
- AGV调试随手记(一)——型号:MIR250
- 运动恢复结构(三维重建task3-1)
- 手把手教学UI自动化测试之数据驱动
- MySQL delete a large number of data tables are locked, and the thread is in the killed state after killing the thread. The problem is solved
- HCIA learning ideas
- 研发质量差,怎么办
- Unity lock the arc motion of the camera around the locked target
- Hololens reading and downloading JSON files (personal hololens2 advanced development summary II)
- 匹配策略方法:已知性检测、互为最近邻、最近邻和次近邻的比、快速匹配的方法等(三维重建task1-6)
- Database beginner's notes
猜你喜欢
Datart open source data visualization application | teach you to develop excellent chart plug-ins
Hcip section 1: network type learning
AGV调式之软件开发—API调用
ms17_010 入侵Win7
Agvmir205 -- software development (API call)
Action principle of NAT
MGRE --- OSPF experiment
Machine learning frequency vs Bayes
Is the subscript operator a monocular operator or a binocular operator
2021 MCU WiFi competition new pattern, domestic MCU WiFi chip inventory, appendix 2020/2021 MCU WiFi ranking
随机推荐
OSPF working process and its simple experiment
Watermelon book chapter 3 - linear model
遵守指南,快速提升自己:功能测试如何快速转向自动化测试
【无标题】HCIP第一天笔记
MGRE experiment
如何从业务测试过渡到测试开发呢?
MySQL经典面试题 14 道
数据分析入门的经典书籍——《精益数据分析》
What happens when a UDP client sends data to a TCP server
MySQL delete a large number of data tables are locked, and the thread is in the killed state after killing the thread. The problem is solved
JDBC uses SQL statement to use limit paging error
Stack simulation queue
如何做 APP 安装测试 ?
C # from entry to mastery (II)
A brief summary of the programming journey in recent years···
APP 登录功能,用例怎么写 ?
On the fifth day, OSPF packets
支付系统测试
Flexible use of postman tools
Visualstudio2019 configuring point cloud library pcl1.11.1+ Stanford rabbit test