include stdio include stdlib include math include locale int main void

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <locale.h>
int main(void)
{
setlocale(LC_ALL, "Russian");
const double PI=3.1415926535;
const double eps=0.00001;
double F, x, s, s1=0.0;
int n=0;
printf ("Введите X:\n");
scanf ("%lf", &x);
s=x;
F=0;
do
{
s1=s1+F;
F=(2/PI)*((pow(x,n))/(n*n+n));
s=s+F;
n++;
}
while (abs(s1-s)>eps);
printf ("%lf", s);
system("PAUSE");
return 0;
}