Enter a positive integer n.
输出格式: Output the value of the partial sum, retaining three decimal places.
#include
#include
using namespace std;
int main ()
{
int n,i=1,x=1,y=1;
float sum;
cin>>n;
while (i<=n)
{
sum+=i/(x*y*1.0);
i++;
x=-x;
y=y+2;
}
cout<
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)