HasheeshEater
@HasheeshEater
The value of the mathematical constant e can be expressed as an infinite series:
e = 1 + 1/1! +1/2! + 1/3! +…
where ! means factorial
n! = n x (n-1)!
Glare Sure! You're going to want to include 2 loops, the outer 1 specifies the current number, and the inner loop will calculate the factorial. Right off the bat, I can tell a way to make a simple for loop that calculates factorials:
float factorial = 1;
for (int i = number; i > 0; i--) {
factorial *= i;
}
This will be your inner loop, which we will adjust soon. Your outer loop will have increment by 1, starting at 1, which is according to the question. For example, the user enters the number2 years ago