Largest Number? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Largest Number?

What's the largest number this program can handle without crashing? It's not something I really need, but it would be great to know so I can limit the input number to avoid crashing the program. I'm not really expecting an answer. Unless there's some supreme nerd out there who wants to solve it xD Just posting this in hopes that somebody DOES decide to solve it. https://code.sololearn.com/Wm0CPovm9N4L/?ref=app

24th Sep 2018, 5:36 AM
Daniel Cooper
Daniel Cooper - avatar
4 Answers
+ 4
Hi! You can comparate your input and output with this website: http://www.calculadoras.uno/factorial/ Then you can know when you must limit the input before the crashing. You can try with the differents ranges of int.
24th Sep 2018, 6:19 AM
Nimrod A. Holguín L.
Nimrod A. Holguín L. - avatar
+ 2
Joshua Martin Fontanilla Is there some kind of joke I'm missing. Should I click that link? (insert thinking emoji)
25th Sep 2018, 11:33 PM
Daniel Cooper
Daniel Cooper - avatar
+ 1
Well, for Java, the range for an int is -2,147,483,648 to 2,147,483,647. Long: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. Short: -32,768 to 32,767 Not sure if these are related but it's worth trying to see if your program won't crash with these numbers.
24th Sep 2018, 6:00 AM
Noah Garza
Noah Garza - avatar
25th Sep 2018, 12:55 PM
Joshua Martin Fontanilla
Joshua Martin Fontanilla - avatar