代码:
#include<stdio.h>
main()
{
int a=3,b=5,i=1;
float s=0;
for(i=1;i<=20;i++)
{
s+=(float)a/b;
a=b;
b+=2;
}
printf("%f\n",s);
}
结果:
17.612028
请按任意键继续. . .
代码:
#include<stdio.h>
main()
{
int a=3,b=5,i=1;
float s=0;
for(i=1;i<=20;i++)
{
s+=(float)a/b;
a=b;
b+=2;
}
printf("%f\n",s);
}
结果:
17.612028
请按任意键继续. . .