This week’s activity consisted of creating a function that would calculate the number e with the precision determined by the user.
The formula to do it is this one:
which is the same as this:
My teacher Ken explained to me that when the difference between two consecutive numbers is less or equal to the precision, the program should stop and return the answer.
Notice how in my function, I’m calling another function, factorial.
It runs like this: