76 255
Assignments Done
Successfully Done
In May 2019

Answer to Question #8679 in C++ for niloofar

Question #8679
How can I write a program that calculates : e^x = 1+x/1!+x^2/2!+x^3/3!+...
Expert's answer
#include <iostream>
#include <cmath>
using namespace std;

void main(){

double x, r=1;

printf("Enter x value: ");

for (int n=1;n<10;n++){
& int f = 1;
& for (int i=1;i<=n;i++) f = f*i;
& r += pow(x,n)/f;

printf("e^%f = %f\n", x, r);


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!


No comments. Be first!

Leave a comment

Ask Your question

Privacy policy Terms and Conditions