Question: c++ loop Question 2/5pt): Print Collatz sequence The Collatz conjecture defines a sequence as follows: if n is an even number, then the next value

c++ loop

c++ loop Question 2/5pt): Print Collatz sequence The Collatz conjecture defines a

Question 2/5pt): Print Collatz sequence The Collatz conjecture defines a sequence as follows: if n is an even number, then the next value is n/2. If n is odd, then the next value is 3n+1. The sequence is conjectured to always reach 1 regardless of the starting number. Write a program that takes a starting number n and prints the entire sequence, starting with n and ending with 1. Each number should be printed on a new line. Expected output example (bold is user input) Enter a positive number: 10 10 PNA

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!