CodePudding user response:
# include
# include & lt; Math. H>
# include & lt; Ctype. H>
Int main ()
{
int n;
Int I=1, sum=1;
Double e=1, TMP;;
The scanf (" % d ", & amp; N);
If (n & gt; 16)
N=16;
If (n & lt; 1) {
Printf (" % 2 lf \ n ", 1.0);
return 0;
}
Do {
The sum *=I;
TMP=1.0/sum;
E +=TMP;
Printf (" I=% d, the sum=% d \ n ", I, sum);
i++;
} while (fabs (TMP) & gt; 1 e - 6 & amp; & I & lt; N);
Printf (" % 2 lf \ n ", e);
return 0;
}
For your reference ~
CodePudding user response:
DDDDDDD