Объяснение:
#include <iostream>
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, sum = 0;
cin >> n >> x;
for (double k = 1; k <= n; k++)
for (double m = k; m <= n; m++)
sum += (x + factorial(k)) / (m + 1);
cout << sum << endl;
Объяснение:
#include <iostream>
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, sum = 0;
cin >> n >> x;
for (double k = 1; k <= n; k++)
{
for (double m = k; m <= n; m++)
{
sum += (x + factorial(k)) / (m + 1);
}
}
cout << sum << endl;
}