Complete the following functions which calculates the summat
Complete the following functions, which calculates the summation as in the equation sum = 1/n + 2/n - 1 + 3/n - 2 + ... + n/1 #include using namespace std; double (int n);//returns void (double, int n);//stores result in double (double i, int n);//recursive void (int n);//use global variable//Global Variable int main() {int n; cout 
Solution
double sum1(int n)
{
double s=0.0;
for(int i=1;i<=n;i++)
{
s=s+(i/(n-i+1));
}
return s;
}
double sum3(double i,int n)
{
i=0.0;
for(int j=1;j<=n;j++)
{
i=i+(j/(n-j+1));
}
return i;
}
void sum4(int n)
{
double i=0.0;
for(int j=1;j<=n;j++)
{
i=i+(j/(n-j+1));
}
printf(\"%lf\",i);
}
void sum2(double sum,int n)
{
sum=0.0;
for(int j=1;j<=n;j++)
{
sum=sum+(j/(n-j+1));
}
printf(\"%lf\",sum);
}

