CodePudding user response:
Post code, don't map,CodePudding user response:
#includeThe main ()
{
Float x;
Double a, b, c, min, sum;
Int the count, I, j, sign;
a=1; B=1; i=1; count=0; Sign=1; Sum=0;
Printf (" Input x: ");
The scanf (" % f ", & amp; x);
For (I=1;; I=I + 2)
{
for(j=1; j<=I; J++)
{
A=a * x;
B=b * j;
Min=a/b;
}
The sum +=sign x min;
Sign=(1) * sign;
count++;
If (min<1-5 e)
{
break;
}
The else
{
continue;
}
}
Printf (" sin (x)=% lf, count=% d \ n ", sum, count);
return 0;
}
CodePudding user response:
Reference:# include
# include
Int main ()
{
Float x;
Double a, b, c, min, sum;
Int the count, I, j, sign;
count=0; Sign=1; Sum=0;//a=1; B=1; i=1;
Printf (" Input x: ");
The scanf (" % f ", & amp; x);
For (I=1;; I +=2) {//for (I=1;; I++)
a=1; B=1;
for(j=1; j<=I; J++) {
A *=x;
B *=j;
Min=a/b;
}
The sum +=sign x min;
Sign=(1) * sign;
count++;
If (fabs (min) & lt; 1 e - 5) break;
If (fabs (min) & gt; E=1-5) continue;
}
Printf (" sin (x)=% lf, count=% d \ n ", sum, count);
return 0;
}
//Input x: 10
//sin (x)=0.544022, count=18
//please press any key to continue...
CodePudding user response:
You choose the first for loop variable I do not have constraints, die run would be in circulation, the outputCodePudding user response:
Thank you thank you, I give it a try