c语言求1+1/2+1/4+1/6+1/8+1/10+1/12+1/14+1/16+1/18+1/20?
c语言求1+1/2+1/4+1/6+1/8+1/10+1/12+1/14+1/16+1/18+1/20?
日期:2022-04-06 02:43:14 人气:1
int i;
float t,s=1;
for (i=1;i<=10;i++){
t = 1.0/(2*i);
s += t;
printf("%d %.4f %.4f\n",i,t,s);
}
printf(&quo