+ 2
Why is my program stuck in a recursive loo
I am trying to make a program where it would display the prime factors of a number but instead it is stuck in a never ending loop. https://code.sololearn.com/c0fcne5pIePB/?ref=app
2 Respostas
+ 8
The condition of your while loop is rem >= 1, despite the comment explicitly stating "rem" should be above 1. I think you meant rem > 1, as a remainder of exactly 1 would be indivisible to any prime factor.
Furthermore, you forgot to increment 'f' after the if conditional, and repeatedly check the prime factor 2 instead of going on.
0
Shadow OMFG THANK YOU SO MUCH!!!!