Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- double silnia(int liczba)
- {
- double wynik;
- if(liczba==0||liczba==1)
- return 1;
- else
- wynik = liczba * silnia(liczba-1);
- return wynik;
- }
- int main()
- {
- int eps;
- int x;
- cout << "Podaj eps: ";
- cin >> eps;
- cout << "Podaj x: ";
- cin >> x;
- cout << endl;
- int i=0;
- double funkcja_exp=0;
- while(abs(pow(x, i)/silnia(i))<eps)
- {
- funkcja_exp += abs(pow(x, i)/silnia(i));
- i++;
- }
- cout << funkcja_exp;
- // funkscja exp(x)
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement