#include"stdio.h"
void main()
{
int i=1,n;
float sum=0;
printf("please input the n:\n");
scanf("%d",&n);
while(i<=n)
{
sum+=1.0/i;
i++;
}
printf("the result is %.5f\n",sum);
}
第五题:编写1+1/2+1/3+...+1/n计算程序
猜你喜欢
转载自blog.csdn.net/m0_54624966/article/details/113107607
今日推荐
周排行