#include"stdio.h"
#include"string.h"
#include"conio.h"
#include"windows.h"
#include"math.h"
double funa (int n);
int main()
{
double u;
int y;
printf("请输入分母的值:");scanf("%d",&y);
u = funa ( y );
printf(" %f \n",u);
return 0;
}
double funa (int n)
{
double add = 0;
double t;
int k;
int s = 1;
for ( k = 1;k <= n; k ++ )
{
s = -s;
t = s * 1.0/k;
add = add + t;
}
return add;
}
望远
相关分类