New course! Every coder should learn Generative AI!
Try a free lesson0
Yep it's okay. It's just a bit heavy to calculate the factorial of great numbers so your phone might simply take forever for that calculation. The only thing to prevent that is to limit the user input to 70 e.g. as max number.
And btw. I wouldn't use break, I'd use the for loops condition instead, that's just cleaner and easier to read :)