My first output keeps repeating (i.e. number = 24 | output= 00000000000000....
Could someone please explain it to me. I have had the same problem when using loops on several occasions.
if (0 < (number % 2))
(number * 3) +1;
else
number = integer / 2;
the integer is not assigned, some compilers will let it be 0.
and so you used while (number != 1) but you have nowhere change number's value, so if you don't input 1, there'll always be infinity loop.
I think you missed assigning integer's value somewhere and have to change
CORRECTION: I was able to resolve the problem, thanks so much.
The point of the program is to use a sequence depending on odd or even to find the last value to be 1. Which is why I am using a sentinel-controlled loop.