当前位置:网站首页>Zhejiang University Edition "C language programming experiment and exercise guide (3rd Edition)" topic set
Zhejiang University Edition "C language programming experiment and exercise guide (3rd Edition)" topic set
2022-07-06 14:42:00 【No two or three things】
experiment 5-7 Use the function to find 1 To 10 Factorials of and
fraction 10
Full screen browsing topics
Switch layout
author Zhang Gaoyan
Company Zhejiang University City College
This problem requires a simple function to calculate the factorial of non negative integers , Makes it possible to use this function , Calculation 1!+2!+⋯+10! Value .
Function interface definition :
double fact( int n );
among n Is the parameter passed in by the user , Its value does not exceed 10. If n Is a nonnegative integer , Then the function must return n The factorial .
Sample referee test procedure :
#include <stdio.h> double fact( int n ); int main(void) { int i; double sum; sum = 0; for(i = 1; i <= 10; i++) sum = sum + fact(i); printf("1!+2!+...+10! = %f\n", sum); return 0; } /* Your code will be embedded here */
sample input :
There is no input for this question .
sample output :
1!+2!+...+10! = 4037913.000000
Code length limit
16 KB
The time limit
400 ms
Memory limit
64 MB
Code implementation :
double fact( int n ){
int i = 1;
for(int j=1;j<=n;j++){
i *= j;
}
return i;
}
边栏推荐
- Query method of database multi table link
- “Hello IC World”
- Statistics 8th Edition Jia Junping Chapter 14 summary of index knowledge points and answers to exercises after class
- High concurrency programming series: 6 steps of JVM performance tuning and detailed explanation of key tuning parameters
- 后台登录系统,JDBC连接数据库,做小案例练习
- 关于超星脚本出现乱码问题
- 《统计学》第八版贾俊平第四章总结及课后习题答案
- AQS details
- 《统计学》第八版贾俊平第十二章多元线性回归知识点总结及课后习题答案
- 《统计学》第八版贾俊平第十一章一元线性回归知识点总结及课后习题答案
猜你喜欢

“Hello IC World”

Markdown font color editing teaching

1. Payment system

数据库多表链接的查询方式
![Transplant hummingbird e203 core to Da Vinci pro35t [Jichuang xinlai risc-v Cup] (I)](/img/85/d6b196f22b60ad5003f73eb8d8a908.png)
Transplant hummingbird e203 core to Da Vinci pro35t [Jichuang xinlai risc-v Cup] (I)

Résumé des points de connaissance et des réponses aux exercices après la classe du chapitre 7 de Jia junping dans la huitième édition des statistiques
![New version of postman flows [introductory teaching chapter 01 send request]](/img/0f/a41a39093a1170cc3f62075fd76182.jpg)
New version of postman flows [introductory teaching chapter 01 send request]

Statistics, 8th Edition, Jia Junping, Chapter 11 summary of knowledge points of univariate linear regression and answers to exercises after class

Network technology related topics

MySQL中什么是索引?常用的索引有哪些种类?索引在什么情况下会失效?
随机推荐
Statistics 8th Edition Jia Junping Chapter 14 summary of index knowledge points and answers to exercises after class
[issue 18] share a Netease go experience
Transplant hummingbird e203 core to Da Vinci pro35t [Jichuang xinlai risc-v Cup] (I)
Chain team implementation (C language)
ES全文索引
Mysql的事务是什么?什么是脏读,什么是幻读?不可重复读?
Uibutton status exploration and customization
Function: calculates the number of uppercase letters in a string
Function: string storage in reverse order
New version of postman flows [introductory teaching chapter 01 send request]
Constants, variables, and operators of SystemVerilog usage
Function: find 1-1/2+1/3-1/4+1/5-1/6+1/7-... +1/n
Fundamentals of digital circuit (IV) data distributor, data selector and numerical comparator
函数:求1-1/2+1/3-1/4+1/5-1/6+1/7-…+1/n
Intranet information collection of Intranet penetration (4)
Statistics 8th Edition Jia Junping Chapter 10 summary of knowledge points of analysis of variance and answers to exercises after class
What is an index in MySQL? What kinds of indexes are commonly used? Under what circumstances will the index fail?
. Net6: develop modern 3D industrial software based on WPF (2)
Markdown font color editing teaching
《统计学》第八版贾俊平第十二章多元线性回归知识点总结及课后习题答案