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

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
Get step-by-step solutions from verified subject matter experts
