Question: c++ Exercise #5 Sequence of Numbers Consider the following algorithm to generate a sequence of numbers. Start with an integer n. If n is even,
Exercise \#5 Sequence of Numbers Consider the following algorithm to generate a sequence of numbers. Start with an integer n. If n is even, divide it by 2 . If n is odd, multiply it by 3 and add 1 . Repeat this process with the new value of n, terminating when n=1. Write a program that prompts the user to enter a positive integer n, finds, and prints n and all the values in the sequence
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
