Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // 8 zadacha
- #include <iostream>
- #include <cmath>
- using namespace std;
- long double fact(int N)
- {
- if (N == 0)
- return 1;
- else
- return N * fact(N - 1);
- }
- int main()
- {
- int x;
- int i = 2;
- scanf("%i", &x);
- float cnt = 1 + x;
- float eps = 10;
- while (cnt < eps) {
- cnt = cnt + (pow(x, i) / fact(i));
- i++;
- }
- printf("%.3f", cnt);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement