I need a C++ program which receives two numbers from input (n, x) and calculates the following equation for entered
numbers (n, x).
1 + x/1! + x2/2! + · · · + xn/n!

Recommended Answers

We cannot just write the program for you but show us what you have already and we'll help.

Jump to Post

All 3 Replies

We cannot just write the program for you but show us what you have already and we'll help.

Here's a small function to get you started. It computes the factorial of a number. You can change it to long double if you really need big numbers. Also, unsigned long long int is platform dependent, if you have any troubles, swich to another data type.

unsigned long long int factorial(int nr){
    unsigned long long int fact = 1;
    for (int i=1;i<=nr;i++) fact *= i;
    return fact;
}

If you provide ur email id i vl send u the code

Be a part of the DaniWeb community

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