Ответы
Ответ дал:
0
#include <iostream>
#include <cmath>
using namespace std;
const double eps = 1E-4;
double a(int n) { return pow(-1.0 / 3.0, n); }
int main()
{
double ans = 0;
int i = 1;
while (abs(a(i)) >= eps)
{
ans += a(i);
++i;
}
cout << ans << endl;
return 0;
}
#include <cmath>
using namespace std;
const double eps = 1E-4;
double a(int n) { return pow(-1.0 / 3.0, n); }
int main()
{
double ans = 0;
int i = 1;
while (abs(a(i)) >= eps)
{
ans += a(i);
++i;
}
cout << ans << endl;
return 0;
}
Вас заинтересует
2 года назад
2 года назад
2 года назад
7 лет назад
7 лет назад
9 лет назад