Write a sub that implements the game "3X+1". It is a very simple game. You start by asking the user to input a positive integer N.
Then, use a loop to test if N is odd or even. If N is odd, then set N= N*3+1. If N is even, then set N= N/2. Repeat this loop until you get N = 1.
You need keep track of how many loops you went through before you get to N = 1.
Report the results (the steps and the corresponding N values, N= 1-20) in a worksheet.
An example of properly working code is as follows:
N=1 N=2 N=3
Steps 0 1
Path of N 1 2 3
1 10 5 16 8 4 2