Question: Need help in my C language assignment... all I need to do is 1.Use recursion instead 2. NO LOOPS ALLOWED Output _______________________________________ What number shall
Need help in my C language assignment... all I need to do is
1.Use recursion instead
2. NO LOOPS ALLOWED
Output _______________________________________
What number shall I start with? 16 sequence: 16 8 4 2 1 length: 5 largest: 16 For start values from 1 to 16: longest: 9 28 14 7 22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1 length: 20 containing largest: 15 46 23 70 35 106 53 160 80 40 20 10 5 16 8 4 2 1 largest: 160
_____________________________________________________________




I'll write the another functions after I get an idea on what to do
// Creates the next input in a sequence int next(int n) int x = n; if (x % 2 == 0) x = x/ 2; return x; else + 1; x = 3 * x return x; // Prints the whole sequence for your input void PrintSequence(int n) for(int x = n; x > 1; x = next(x)) printf("%i", x); printf("1"); // Creates a count for the sequence Hint length(int n) int count = 1; int x = n; while(x > 1) X = next(); count++; return count; // Creates the largest number in the first sequence int largest(int n) int max = n; int X = n; while(x != 1) if(max
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
