分数递推求和题,第一个分数(1+2)/(1*2)+.........+(2019+2020)/(2019*2020)考生作答是我的答案,但是只要一分,求大佬找错
#include <stdio.h>#define float double
void PRINT(double s)
{
FILE *out;
printf("s=%.5lf\n",s);
if((out=fopen("result.dat","w+"))!=NULL)
{
fprintf(out,"s=%.5lfs",s);
fclose(out);
}
}
int main()
{
int i=1,j=2;
double s=0;
while(i<2020)
{s=(double)(i+j)/(i*j);
i++,j++;
s+=s;}/*考生在此设计程序*/
PRINT(s);
}