Write a simple program to prompt the user to key in x and n value to calculate the result for the following formula:

Result = 1+2!/((x-2))-3!/((x-3))+4!/((x-4) )- … n!/((x-n))

Note: x value must be greater than n value.

i need help for C++ programming class work
thanks a lot

Recommended Answers

All 3 Replies

Have you written any code for this?

What part of the task are you having trouble with? Can you write a simple main() function that asks for and stores values for x and n? That'd get you started.

Hint : As there is factorial, you might use a user defined function that does the factorial part for you.

Be a part of the DaniWeb community

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