This task was not exactly easy because there were different ways to understand the instructions.

What I did in my code was to give the number of iterations I wanted to do (of course as the number was bigger, the result was more accurate)

So it was all about a factorial function, and the function which takes the factorial and does the process. With a for loop, I only counted the iterations and that was all! Check my code:

enumber.cpp

CC BY 4.0 #WSQ14 calculating e by eduardomacielm is licensed under a Creative Commons Attribution 4.0 International License.