Live Factorial Calculator

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to previous page   go to home page   go to next page

Answer:

Maybe. Even with double, overflow is reached at N==170.

Another problem with double is that the result is only an approximation to the exact value. doubles have the equivalent of about 15 decimal digits of accuracy. This might not be good enough.

Live Factorial Calculator

Here is a Javascript version of the factorial calculator:



Enter N:

Try some values for N that test the boundaries: -1, 0, 20. Then try some small values like 6 or 12.

QUESTION 13:

If you drop a brick from a tower, what happens?