Question: With C programming language Create a function (use an informative function name) that prints out and counts the length of the Collatz sequence for the

With C programming language
Create a function (use an informative function name) that prints out and counts the length of the Collatz sequence for the random number you just generated. Collatz sequence is iterated for positive integers like this: i. n-> n/2 (so if n is even (=parillinen in Finnish), divide it by two) ii. n-> 3n+ 1 (so if n is odd (=pariton in Finnish), triple it and add one) iii. For example, for number 13 the sequence (and output print) is like this (sequence starts from 13 and ends when it reaches 1): . Collatz sequence for 13 is: 13-40 - 20-10-5-16-8-4-2-1 . Length of the sequence is: 10 iv. Notice that Collatz length includes the given number itself and also number 1 (where the sequence ends) V. Remember that random number can also be 0 or 1. Test both carefully
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
