For example Factorial two, or 2! would be 2*1, which equals 2. Factorial 4 (4!), is 4*3*2*1, which is 24. As the numbers get higher, it becomes quite the ordeal to multiply these out, and a factorial calculator becomes very useful.
The code is displayed below.
Because of the limitations of the standard int (integer) variable type in Java, the maximum our calculator can calculate without errors is factorial 13, as any number larger than that creates a value too large for the standard Java variable to handle.
To make this program work we used For loops to run the logic of the actual factorial maths. We learned about for loops many times through the different languages we have learned so far and they proved to be invaluable in making the code more efficient. At the end of the code, the result is returned to the user as all of the factorial values from 1 to 13.


