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
What behaviors are most common in a successful entrepreneurship
Kryger [21]
1. Proper planning
2. Honesty
3. Being reasonable in pricing
4. Knowledge of what you’re offering
5. Being kind/good to your clients
8 0
3 years ago
What component uses thermal paste to attach the heat sink?
natka813 [3]

Answer:

Thermal Compound/Thermal Grease

Explanation:

Thermal compound, also known as thermal paste and thermal grease, is a material used to fill the microscopic gaps between a computer's CPU and its heat sink. Thermal compound significantly increases the heat sink's ability to cool the CPU, allowing the CPU to run at a higher speed and improve system performance.

6 0
3 years ago
Write a Python program to solve the problem described above. Define a function satisfactory_meal(Meal) which takes a single para
kompoz [17]

def dx(fn, x, delta=0.001):

   return (fn(x+delta) - fn(x))/delta

def solve(fn, value, x=0.5, maxtries=1000, maxerr=0.00001):

   for tries in xrange(maxtries):

       err = fn(x) - value

       if abs(err) < maxerr:

           return x

       slope = dx(fn, x)

       x -= err/slope

   raise ValueError('no solution found')

3 0
1 year ago
Query " frosty the snowman
julsineya [31]
I don't think that is a query...
5 0
3 years ago
What is the khan academy game where it is a block having to jump over lava and is an endless runner
saw5 [17]

Answer:https://www.khanacademy.org/computer-programming/lava-the-impossible-game-by-swax97/4638717300965376/embedded?id=1436456095000-0.5&origin=undefined&buttons=yes&embed=yes&editor=no&author=yes

Explanation:

5 0
3 years ago
Other questions:
  • It's time for you to schedule a dental checkup. The responsible thing to do is to ___
    11·1 answer
  • IF YOU KNOW THE ANSWER TO THIS PLEASE ANSWER ASAP
    12·1 answer
  • A method that receives a two-dimensional array uses two ____ pairs following the data type in the parameter list of the method h
    11·1 answer
  • Mobile devices need to work within limited screen space ? true or false
    9·2 answers
  • List three tacos there are several from the opening page of the help and support center.
    5·1 answer
  • The word ____ at the end of several of the member functions in the accompanying class definition specifies that these functions
    10·1 answer
  • Explain the different features available in Print command?
    10·1 answer
  • How is data written to a blockchain?
    10·1 answer
  • Explain why regular system cleanup is vital to ensuring the operating system runs efficiently. ?
    15·1 answer
  • what is one benefit of placing voip gateways in geographically separated branch offices that have an existing wan connection?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!