#include <stdio.h>
int main()
{
int d = 1;
int i, n;
scanf("%d", &n);
double sum, flag = 1;
for(i = 1; i <= n; i++)
{
sum = sum + flag / d;
d = d + 3;
flag *= -1;
}
printf("sum = %.3lf", sum);
return 0;
}
另类的Sn
最新推荐文章于 2024-08-28 18:40:22 发布