函数fun的功能是:求S的值。S=(2k)*(2k)/(2k-1)(2k+1).
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<math.h>
double fun(int k)
{
int n;
double s, w, q, p;
n = 1;
s = 1.0;
while (n <= k)
{
w = 2.0*n;
p = w - 1.0;
q = w + 1.0;
s = s*w*w / p / q;
n++;
}
return s;
}
int main()
{
printf("%lf\n", fun(10));
system("pause");
return 0;
}