#include
float fun(int n)
{
float sum=0;
for(float i=1;i<=n;i++)
{
float f=1/(i*(i+1));
sum=sum+f;
}
return sum;
}
void main()
{
int a=5;
cout<
}
#include
#include
double fun(int n)
{
int i;
double sum = 0.0;
double temp;
for(i = 1;i<=n;i++)
{
temp = i*(i+1);
sum += 1/temp;
}
return sum;
}
int main()
{
int n;
printf("input n:\n");
scanf("%d",&n);
double re = fun(n);
printf("result = %f",re);
// system("pause");
return 0;
}