C语言程序设计基础的题目

写代码 计算数列:n-n/2+n/3-n/4+…-n/100

是这样吗
#include<stdio.h>
#include<math.h>
int main()
{
double n,s;
int j;
scanf("%lf",&n);
s=0;
for(j=1;j<=100;j++)
{
if(j%2==0)
s-=n/j;
else
s+=n/j;
}
printf("%.2f\n",s);
return 0;
}