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
A field whose data type is ____ can store text that can be used as a hyperlink address
olya-2409 [2.1K]
A field whose data type is URL address data can store text that can be used as a hyperlink address.
8 0
3 years ago
Who were 4 major people that attended the constitutional convention
postnew [5]
Alexander Hamilton, George Washington, James Madison, and Benjamin Franklin
7 0
4 years ago
It is possible to play older console games such as those written for the nintendo game boy or sega genesis on a personal compute
timurjin [86]
Emulator««««that is the answer
5 0
3 years ago
Ethernet and wireless networks have some similarities and some differences. One property of Ethernet is that only one frame at a
Arada [10]

802.11 do not share this property with Ethernet this is because Wireless networks is known to have a kind of potential parallelism, and as thus, it differ from Ethernet.

<h3>What is a Wireless networks?</h3>

Wireless networks are known to be a kind of computer networks that are said to not need to be connected by form of cables.

The use of a wireless network is one that helps firms to avoid the costly prices of using cables in their buildings or as a form of connection between their various equipment locations.

Learn more about Ethernet from

brainly.com/question/1637942

4 0
2 years ago
How many degrees of freedom does any unconstrained object have in 3-D modeling?
Free_Kalibri [48]
I think its 6 degrees

3 0
3 years ago
Other questions:
  • Consider sorting n numbers stored in array A by first finding the smallest element of A and exchanging it with the element in A[
    13·1 answer
  • What does Pentium means?:/
    7·2 answers
  • MULTIPLE CHOICE QUESTION PLEASE HELP!!!!!!!!!
    14·2 answers
  • Which of the following accessories would you use to create a drawing? A. Calculator B. Notepad C. Paint D. WordPad
    14·2 answers
  • What is Patch tool ???<br><br>​
    15·2 answers
  • Linux is a kind of software whose code is provided for use, modification, and redistribution. what kind of software is this?
    5·1 answer
  • Write two examples of hard copy output?​
    9·1 answer
  • Waygate's residential Internet modem works well but is sensitive to power-line fluctuations. On average, this product hangs up a
    6·1 answer
  • Only need help on f and correct me if im wrong for the other questions please
    11·1 answer
  • Give an example of what Artificial Intelligence application most popular is used on a daily basis.
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!