Ответ:
Объяснение:
#include <iostream>
#include <cmath>
using namespace std;
double factorial(double number)
{
if (number < 0)
return 0;
if (number == 0)
return 1;
else
return number * factorial(number - 1);
}
int main()
double n, x, result, sum = 0;
cin >> n >> x;
for (int k = 1; k <= n; k++)
sum += pow(-1, k) * pow(x, k) / factorial(factorial(k) + 1);
result = sum / factorial(n);
cout << result << endl;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
Ответ:
Объяснение:
#include <iostream>
#include <cmath>
using namespace std;
double factorial(double number)
{
if (number < 0)
return 0;
if (number == 0)
return 1;
else
return number * factorial(number - 1);
}
int main()
{
double n, x, result, sum = 0;
cin >> n >> x;
for (int k = 1; k <= n; k++)
{
sum += pow(-1, k) * pow(x, k) / factorial(factorial(k) + 1);
}
result = sum / factorial(n);
cout << result << endl;
}