一、N-S流程图;
二、运行结果;
三、源代码;
# define _CRT_SECURE_NO_WARNINGS
# include <stdio.h>
int main()
{
//初始化变量值;
double a = 0, b = 1, result1 = 2, sum = 0;
int i = 0;
//循环运算;
for (i = 1; i <= 20; i++)
{
//运算;
result1 = result1 + a;
sum = result1 / b + sum;
a = b;
b = result1;
}
//输出结果;
printf("结果为:%f\n", sum);
return 0;
}