Friday, October 7, 2022

Exp

 #include <iostream>

#include <math.h>

using namespace std;

int main()

{

double x,s,a,b;

cin >> x;

cout << x << " " << exp(x) <<" ";

s = 1; a = x; b = 1;

for (int i = 1; i < 1000; i++)

{

s = s + a / b;

a = a * x;

b = b * (i + 1);

}

cout << s << "\n";

}


No comments:

Post a Comment

N-point Star in Microsoft Visual Studio Console App

#include <windows.h> #include <cmath> #include <iostream> LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam,...