1+1/2+2/3+.....+n-1/n=? 编程怎么编啊

来源:百度知道 编辑:UC知道 时间:2024/05/05 00:22:22
急用!各位高手帮帮忙!

#include <iostream.h>
void main()
{
float s=0;
int n;
cout<<"please input the n"<<endl;
cin>>n;
for(float i=1;i<=n;i++)
{
s=i/(i+1)+s;
}
cout<<"The result is :"<<s+1<<endl;
}

你用什么语言编写?不说咋给你帮忙?