mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-12-19 07:00:35 +08:00
The factorial method can be simplified to 2 lines, which I believe is easier to read. Also, in previous version, if user enters two negative numbers back to back, the program crashes. We need a while loop to prompt the user until they actually enter the correct input, instead of only prompting them once. Also, if user enters a character instead of an integer, program crashes with no error message. We should fail more gracefully.
1.4 KiB
1.4 KiB