#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
int main()
{
double a = 1.0;
double b = 1.0;
double Sn = 0;
int i = 0;
for (i = 0; i < 20; i++)
{
a = a + b;
b = a - b;
Sn += (a / b);
}
printf("Sn=%f\n", Sn);
system("pause");
return 0;
}
时间: 2024-10-15 03:03:26