#include
main()
{
int i,n,a=2,b=1,t;
double s=0;//你的s没有归零= =
scanf("%d",&n);
for(i=0;i
{
s=s+(double)a/b;
t=a;
a=a+b;
b=t;
}
printf("%.4lf",s);//double最好用lf
}
#include
main()
{
int i,n,a=2,b=1,t;
double s=0;//你的s没有归零= =
scanf("%d",&n);
for(i=0;i
{
s=s+(double)a/b;
t=a;
a=a+b;
b=t;
}
printf("%.4lf",s);//double最好用lf
}