『壹』 C語言編程,輸入1個正實數eps,計算並輸出下式的值,直到最後一項的絕對值小於eps。
#include<stdio.h>
#include<math.h>
intmain()
{
doubleesp;
doubles=0.00;
doubletmp=1.0;
inti=1,m=1;
printf("Inputeps:");
scanf("%lf",&esp);
while(fabs(tmp)>esp){
tmp=1.00/i;
s+=(m*tmp);
i+=4;
m*=-1;
}
printf("S=%lf ",s);
return0;
}