Westonci.ca is your trusted source for finding answers to all your questions. Ask, explore, and learn with our expert community. Explore our Q&A platform to find in-depth answers from a wide range of experts in different fields. Experience the convenience of finding accurate answers to your questions from knowledgeable experts on our platform.

Overview Write a program that reads an integer from the user and then prints the Hailstone sequence starting from that number "What is the hailstone sequence?" you might ask. Well, there are two rules: • If n is even, then divide it by 2 • If n is odd, then multiply it by 3 and add 1 Continue this sequence until you hit the number 1.​

Overview Write A Program That Reads An Integer From The User And Then Prints The Hailstone Sequence Starting From That Number What Is The Hailstone Sequence You class=

Sagot :

n=int(input("Enter number: "))

while n != 1:

   print(n)

   if n%2==0:

       n//= 2

   else:

       n = (n*3)+1

print(n)

I wrote my code in python 3.8. If you want to print the 1, keep the last line of code otherwise delete it.