1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Arturiano [62]
3 years ago
15

The value of the mathematical constant e can be expressed as an infinite series: e=1+1/1!+1/2!+1/3!+... Write a program that app

roximates e by computing the value of 1+1/1!+1/2!+1/3!+...+1/n! where n is an integer entered by the user.
Computers and Technology
1 answer:
LUCKY_DIMON [66]3 years ago
6 0

Answer:

// here is code in c++ to find the approx value of "e".

#include <bits/stdc++.h>

using namespace std;

// function to find factorial of a number

double fact(int n){

double f =1.0;

// if n=0 then return 1

if(n==0)

return 1;

for(int a=1;a<=n;++a)

       f = f *a;

// return the factorial of number

return f;

}

// driver function

int main()

{

// variable

int n;

double sum=0;

cout<<"enter n:";

// read the value of n

cin>>n;

// Calculate the sum of the series

  for (int x = 0; x <= n; x++)

  {

     sum += 1.0/fact(x);

  }

  // print the approx value of "e"

    cout<<"Approx Value of e is: "<<sum<<endl;

return 0;

}

Explanation:

Read the value of "n" from user. Declare and initialize variable "sum" to store the sum of series.Create a function to Calculate the factorial of a given number. Calculate the sum of all the term of the series 1+1/1!+1/2!.....+1/n!.This will be the approx value of "e".

Output:

enter n:12

Approx Value of e is: 2.71828

You might be interested in
The __________ is a worldwide collection of networks that links millions of businesses, govenment agencies, educational institut
Vlad [161]
<span>The INTERNET is a worldwide collection of networks that links millions of businesses, government agencies, educational institutions, and individuals.</span>
5 0
3 years ago
Identify the different groups of keys on a keyboard
kifflom [539]

Answer:alphabetic keys, numeric keys, function keys and special keys.

Explanation:

6 0
3 years ago
Suppose we are given an arbitrary digraph G = (V, E) that may or may not be a DAG. Modify the topological ordering algorithm so
lianna [129]

Answer:

Check the explanation

Explanation:

We can utilize the above algorithm with a little in modification. If in each of the iteration, we discover a node with no inward edges, then we we’re expected succeed in creating a topological ordering.

If in a number of iteration, it becomes apparent that each of the node has a minimum of one inward edge, then there must be a presence of cycle in the graph.

So our algorithm in finding the cycle is this: continually follow an edge into the node we’re presently at (which is by choosing the first one on the adjacency list of inward edges to decrease the running time).

Since the entire node has an inward edge, we can do this continually or constantly until we revisit a node v for the first time.

The set of nodes that we will come across among these two successive visits is a cycle (which is traversed in the reverse direction).

3 0
3 years ago
"the ________ attribute of the anchor tag can cause the new web page to open in its own browser window."
zheka24 [161]
Target





-------------------------------
8 0
3 years ago
What best describes the difference between careers and industries?
Rasek [7]

Answer:

c

Explanation:

big brain

3 0
3 years ago
Other questions:
  • Please draw a diagram of a complete graph with 5 vertices (K5), its adjacency matrix and adjacency list representations.
    5·1 answer
  • 5. Tricks of the language commercials use are called Rhetorical Devices?
    9·1 answer
  • A tower or mini tower pc is a type of all- in -one unit true or false
    9·2 answers
  • In this part, you have to implement a linked list that maintains a list of integers in sorted order. Thus, if the list contains
    13·1 answer
  • In the Dynamic Partitioning technique of memory management, the placement algorithm that scans memory from the location of the l
    11·1 answer
  • 3. State whether the given statements are true or false. a. The computer is called a data processor because it can store, proces
    13·1 answer
  • Choose the tag required for each stated goal.
    12·1 answer
  • Why can't this app have people ask riddles.
    8·1 answer
  • I dont know how to put the negative sigh on my computer
    5·2 answers
  • How will you maintain electrical tools and equipment?
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!