0
What's wrong with my code?
What making this an infinite loop? https://code.sololearn.com/c8T8p84Fqgwv
3 Answers
+ 2
There's no class, your code only contains a method.
Please tag Java rather than the code link up there đ
+ 1
Thank you @Ipang!
By the way, whole code is bit longer that's why I only posted a method! All I want to know is what's making it an infinite loop?
+ 1
Manoj Kumar
I just checked your code again by pasting it in an empty class. It works, no infinite loop.
I don't think you need <FinalReversedNumber>. You can do
boolean <isNegative> = <number> less than zero
If <isNegative>
<number> = Math.abs(<number>)
while()
...
If isNegative
return reversedNumber * -1
Else
return reversedNumber



