当前位置:网站首页>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;
}
边栏推荐
- 1. Payment system
- Lintcode logo queries the two nearest saplings
- Load balancing ribbon of microservices
- . Net6: develop modern 3D industrial software based on WPF (2)
- 【指针】使用插入排序法将n个数从小到大进行排列
- 《统计学》第八版贾俊平第二章课后习题及答案总结
- 《统计学》第八版贾俊平第十三章时间序列分析和预测知识点总结及课后习题答案
- 《统计学》第八版贾俊平第三章课后习题及答案总结
- The most popular colloquial system explains the base of numbers
- 浙大版《C语言程序设计实验与习题指导(第3版)》题目集
猜你喜欢

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

"If life is just like the first sight" -- risc-v

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

《统计学》第八版贾俊平第四章总结及课后习题答案

关于交换a和b的值的四种方法

《统计学》第八版贾俊平第五章概率与概率分布

移植蜂鸟E203内核至达芬奇pro35T【集创芯来RISC-V杯】(一)

Solutions to common problems in database development such as MySQL

What is the transaction of MySQL? What is dirty reading and what is unreal reading? Not repeatable?

《统计学》第八版贾俊平第二章课后习题及答案总结
随机推荐
Keil5-MDK的格式化代码工具及添加快捷方式
Network technology related topics
数字电路基础(五)算术运算电路
指针 --按字符串相反次序输出其中的所有字符
Pointer -- eliminate all numbers in the string
Library management system
Statistics 8th Edition Jia Junping Chapter 14 summary of index knowledge points and answers to exercises after class
Intranet information collection of Intranet penetration (2)
Data mining - a discussion on sample imbalance in classification problems
The difference between layer 3 switch and router
Summary of thread implementation
. Net6: develop modern 3D industrial software based on WPF (2)
《統計學》第八版賈俊平第七章知識點總結及課後習題答案
线程的实现方式总结
Statistics 8th Edition Jia Junping Chapter 12 summary of knowledge points of multiple linear regression and answers to exercises after class
Es full text index
Function: find the maximum common divisor and the minimum common multiple of two positive numbers
Solutions to common problems in database development such as MySQL
MySQL interview questions (4)
[pointer] counts the number of times one string appears in another string