current position:Home>Questions about C: please be more detailed about C programming program
Questions about C: please be more detailed about C programming program
2022-02-04 16:34:31 【CSDN Q & A】
C# Programming questions, please be more detailed , beginner , thank you
Take the answer :
using System;namespace ConsoleApp1{ class Program { static long fac(int n)// Calculation n The factorial { return n == 0 ? n * fac(n - 1) : 1;// Such as n by 0 or 1 The return value is 1, If not 0,1 Then return to n*(n-1)! } static void Main(string[] args) { Console.WriteLine(" Input n Value :"); int n = int.Parse(Console.ReadLine()); long e = 0; for (int i = 0; i <= n; i++) { e = e + 1 / fac(n);// Calculated value e = 1/0!+1/1!+1/2!+......+1/n! } Console.WriteLine("e Value :"+e.ToString()); } }}
Other answers 2:
First use a function to calculate the factorial .
Then find its reciprocal .
Sum up .
Other answers 3:
You can use the idea of recursion to calculate
copyright notice
author[CSDN Q & A],Please bring the original link to reprint, thank you.
https://en.cdmana.com/2022/02/202202041634296824.html
The sidebar is recommended
- How to turn async into synchronous async await!!
- What is the scheme of DTS data subscription (new version)?
- What is the difference between MySQL clustered index and non clustered index?
- What is the scheme of data subscription (old version) of DTS?
- How to ensure the order of messages when Kafka is distributed in spark?
- What does data skew mean in spark?
- What is the difference between data migration and data synchronization in applicable scenarios?
- How should MapReduce optimize the method in the map phase?
- How is data skew caused in spark?
- What is the difference between data migration and data synchronization in the supported database deployment location?
guess what you like
-
What is the specific solution of data skew in spark?
-
What are resource groups in dataworks?
-
What is the difference between the functional characteristics of data migration and data synchronization?
-
What is the difference between data migration and data synchronization in billing methods?
-
What resource groups are there for data integration in dataworks?
-
How to understand the shuffle process in spark?
-
What is the difference between billing data synchronization and data migration?
-
What are the aggregation operators in spark? What types of operators should we try to avoid?
-
What is the role of data migration in DTS?
-
What is the description of structure migration in DTS?
Random recommended
- Why is spark fast? Must spark SQL be faster than hive
- What is the description of full data migration in DTS?
- What is the description of incremental data migration in DTS?
- What does RDD in spark mean?
- What is the basic logical architecture of the crowd selection system based on maxcompute + hologres?
- What are the multiple ETL features supported by data migration in DTS?
- How should MapReduce optimize the method in the reduce phase?
- What is the RDD operator in spark and how to understand it?
- What is the alarm mechanism of data migration in DTS?
- What is the migration task management of data migration in DTS?
- What does DAG in spark mean?
- What are the technical requirements for crowd selection based on maxcompute + hologres?
- What does stage mean in spark?
- How can RDD in spark be fault tolerant through record updating?
- What are the core demands of the service engine of the crowd selection system based on maxcompute + hologres?
- What are the isolation levels of MySQL transactions?
- What do you mean by wide dependence and narrow dependence in spark?
- What does MySQL mean by unreal reading, dirty reading and non repeatable reading?
- What is the description of the scheduling strategy of multi copy mode in DTS data integration?
- What are the applicable scenarios of the scheduling strategy of multi copy mode in DTS data integration?
- How many calculation modes can the crowd circle selection system based on maxcompute + hologres be divided into?
- How to understand wide dependence and narrow dependence in spark?
- What is the description of the scheduling strategy of resynchronization mode in DTS data integration?
- What are the applicable scenarios for the scheduling strategy of resynchronization mode in DTS data integration?
- How can MySQL safely modify the same row of data under high concurrency?
- What is the description of the scheduling strategy of incremental mode based on timestamp in DTS data integration?
- How do you understand job and task in spark?
- Why can hologres support high performance and high throughput writes?
- Count the number of positive and negative integers in the input data. How to end with 0
- Mafan help me solve these questions, GanXie!
- Vivado is associated with Modelsim simulation, and the coverage test is always unsuccessful. How to solve it?
- Docker container related issues.
- The assignment cannot be performed because the size on the left is 400 × 1200, 400 on the right × four hundred × 3。
- WinForm which table control can realize the following functions?
- Click the icon 123 of hot search to display the corresponding picture
- C beginners want to be more detailed
- About the movement of stack pointer%rsp
- Ad5761 cannot output voltage, and the SPI readback value is incorrect
- In centos7, the virtual environment PIP install uwsgi reports an error
- Please help me with a problem