2013-07-02T07:09:59-04:00
write a program to find the sum of following series:-
1+x/1!+x^3/2!+x^5/3!+............+x^(2n-1)/n!
1
2013-07-12T08:10:18-0400
#include <iostream> #include <conio.h> using namespace std; double factorial(long n){ if (n < 1) return 0; double product = 1; for (int i = 1; i <= n; i++) product *= i; return product; } //main function int main() { double x; double sum=1; cout<<"Enter x = ";//input x cin>>x;//read x //calculate sum for(int n=1;n<10;n++){ sum+=pow(x,(2*n-1))/factorial(n); } //show result cout<<"Sum="<<sum; getch();//delay return 0; }
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 !
Learn more about our help with Assignments:
C++
Comments