This lab we use a While loop to recognize even and Odd numbers and run a countdown till its 1 to end the program.

 

 

 

inputStr = raw_input(“Enter an interger: “)
A = int(inputStr)
if A%2 == 0:
print “Number is Even: ”
else:
print “Number is Odd, Starting Countdown: ”

while A!= 1:
if A%2 == 0:
A = A/2
else:
A = A * 3 + 1
if A == 1:
print’Done’
else:
print A