Hello, I am having problems doing calculations in a loop.
What Im trying to do is- count from number1 to number2- which i did using a FOR loop. So, say the numbers are 3 4 5 6 7, I need to take each one of those numbers and perform a calculation to it based on whether it is odd or even.
I can do the calculation for "number1" and "number2", but am going no where on the numbers in between. Please help!!!
Here's how im counting:
if(n1>n2)
for(i=n2;i<=n1;i++)
else
for(i=n2;i>=n1;i--)
and heres my individual calculations:
while(n1>1)
if(n1%2==0)
n1=n1/2;
else
n1=n1*3+1;