i have to write a program to find sum of the sequence using loops
the sequence is
x-x^2/2!+x^3/3!-x^4/4!+.....

And what is the problem?
To help you a little, your sequence is the same as:
(-1)^2 * x^1/1! + (-1)^3 * x^2/2!...

Yet another prompting:
X(1) + X(2) + ... +X(n)+...
X(1) = x
X(n) = (+/-)x*x*...n times / (1*2*...*(n-1)*n) = (-x/n) * X(n-1)
It's so simple ;)...

hmm ... and then

n/n! = n/n*(n -1 )! = 1/(n-1)!

To stilllearning:
Moreover, 2*2 == 4.
Have you ever seen that words: recurrence formula?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.