image.png
double sum = 0;
double a = 2;
double b = 1;
for (int i = 1; i < 21; i++)
{
sum += a / b;
double temp = a;
a = a + b;
b = temp;
}
Console.WriteLine(sum);
网友评论