67 258
Assignments Done
99,1%
Successfully Done
In November 2018

Answer to Question #28102 in C++ for Wedd

Question #28102
write a program in C++ for the function a(n)=((2n+1)/(2n!)^2)
Expert's answer
#include <iostream>
using namespace std;

long double calc(int n) {
long double res = (2*n + 1) / 4.0;
for (int i = 2; i <= n; i++)
& res /= i*i;
return res;
}

int main() {
cout << "Input n: ";
int n;
cin >> n;
cout << "(2n+1)/(2n!)^2 = " << calc(n) << endl;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions