#include <iostream>
#include <cmath>
using namespace std;
signed main()
{
setlocale(LC_ALL, "Rus");
double s = 0.0, x;
int K;
cout << "Введите число X: ";
cin >> x;
cout << "Введите число K: ";
cin >> K;
if (x > 0.5) {
for (size_t k = 1; k <= K; k++)
s += (pow(x - 1.0, k) / (k * pow(x, k)));
cout << "S = " << s << endl;
}
else
cout << "\nX < 0.5\n";
return 0;
#include <iostream>
#include <cmath>
using namespace std;
signed main()
{
setlocale(LC_ALL, "Rus");
double s = 0.0, x;
int K;
cout << "Введите число X: ";
cin >> x;
cout << "Введите число K: ";
cin >> K;
if (x > 0.5) {
for (size_t k = 1; k <= K; k++)
s += (pow(x - 1.0, k) / (k * pow(x, k)));
cout << "S = " << s << endl;
}
else
cout << "\nX < 0.5\n";
return 0;
}