Advertisement
MeehoweCK

Untitled

Nov 2nd, 2020
2,037
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. double e(double x)
  6. {
  7.     double wynik = 1;
  8.  
  9.     double potega_x = 1;
  10.     unsigned long long silnia = 1;
  11.  
  12.     for(int i = 1; i < 15; ++i)
  13.     {
  14.         potega_x *= x;
  15.         silnia *= i;
  16.  
  17.         wynik += (potega_x / silnia);
  18.     }
  19.  
  20.     return wynik;
  21. }
  22.  
  23. int main()
  24. {
  25.     cout << e(3.7);
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement