Write a program in c++ that finds the sum of the below given sequences, computes
ID: 3669340 • Letter: W
Question
Write a program in c++ that finds the sum of the below given sequences, computes the total number of elements given some parameters and also computes the x th term of the series. The x th term is an user input. Also indicate if the below sequences are in arithmetic progression, geometric progression or neither of them.
. Consider a sequence: 1/1! + 2/2! + 3/3! +. . . 1/N!. Find the recurrance relation for the above series, this need not be programmed. Then, compute the sum of ’n’ elements in this sequence where ’n’ is an user input.
Explanation / Answer
#include <stdio.h>
double sumseries(double);
main()
{
double number,sum;
cout<<" Enter the value: ";
cin>>number;
sum = sumseries(number);
cout<<” Sum of the above series "+ sum);
}
double sumseries(double m)
{
double sum2 = 0, f = 1, i;
for (i = 1; i <= m; i++)
{
f = f * i;
sum2 = sum2 +(i / f);
}
return(sum2);
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.