#pragma warning(disable:4996)标签:lf,1.0,int,求前,printf,0.0 From: https://blog.51cto.com/u_15880518/5878332
#include<stdio.h>
int main()
{
int i = 0;
double z = 0.0;
int n = 0;
printf("请输入n:");
scanf("%d", &n);
for (i = 1;i <= n;i++)
{
z += 1.0 / i;
}
printf("前n项和为%lf\n", z);
return 0;
}