当前位置:网站首页>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;
}
边栏推荐
- 《统计学》第八版贾俊平第五章概率与概率分布
- 指针--剔除字符串中的所有数字
- Pointer -- eliminate all numbers in the string
- High concurrency programming series: 6 steps of JVM performance tuning and detailed explanation of key tuning parameters
- 关于超星脚本出现乱码问题
- Intranet information collection of Intranet penetration (4)
- How to earn the first pot of gold in CSDN (we are all creators)
- 循环队列(C语言)
- 《统计学》第八版贾俊平第三章课后习题及答案总结
- 函数:计算字符串中大写字母的个数
猜你喜欢
![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)

王爽汇编语言详细学习笔记二:寄存器

Statistics 8th Edition Jia Junping Chapter XIII Summary of knowledge points of time series analysis and prediction and answers to exercises after class

Lintcode logo queries the two nearest saplings

关于超星脚本出现乱码问题

数字电路基础(一)数制与码制

《统计学》第八版贾俊平第十章方差分析知识点总结及课后习题答案

数据库多表链接的查询方式

Proceedingjoinpoint API use

《统计学》第八版贾俊平第九章分类数据分析知识点总结及课后习题答案
随机推荐
Pointer -- eliminate all numbers in the string
《统计学》第八版贾俊平第十二章多元线性回归知识点总结及课后习题答案
Harmonyos application development -- address book management system telmanagesys based on listcontainer [phonebook][api v6]
浙大版《C语言程序设计实验与习题指导(第3版)》题目集
Fire! One day transferred to go engineer, not fire handstand sing Conquest (in serial)
Markdown font color editing teaching
Statistics 8th Edition Jia Junping Chapter 14 summary of index knowledge points and answers to exercises after class
Always of SystemVerilog usage_ comb 、always_ iff
What is the transaction of MySQL? What is dirty reading and what is unreal reading? Not repeatable?
王爽汇编语言详细学习笔记二:寄存器
【指针】求解最后留下的人
Mysql的事务是什么?什么是脏读,什么是幻读?不可重复读?
四元数---基本概念(转载)
servlet中 servlet context与 session与 request三个对象的常用方法和存放数据的作用域。
Query method of database multi table link
数字电路基础(二)逻辑代数
Wang Shuang's detailed learning notes of assembly language II: registers
《统计学》第八版贾俊平第五章概率与概率分布
[pointer] the array is stored in reverse order and output
[pointer] solve the last person left