#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;
}
本文出自 “零点时光” 博客,请务必保留此出处http://10741764.blog.51cto.com/10731764/1708437
计算2/1+3/2+5/3+8/5+.......+(共20项)
原文:http://10741764.blog.51cto.com/10731764/1708437