Question: please all the questions thanks 6 Write an algorithm to input a list of numbers and test whether the numbers are in increasing order of

please all the questions
thanks
please all the questions thanks 6 Write an algorithm to input a

6 Write an algorithm to input a list of numbers and test whether the numbers are in increasing order of magnitude, giving an appropriate message as output. The algorithm should be designed so that testing stops as soon as the answer is known. 7 Modify the algorithm in Example 1.3.1 so that it gives the correct output when n = 0 is input. 8 The following algorithm calculates a number known as the digital root' of a positive integer. 1. Input a positive integer n 2. d-number of digits in n 3. While d > 1 do 3.1. ne sum of the digits of n 3.2. d-number of digits in n 4. Output n (a) Trace the algorithm when 8678 is input. (b) List all the possible values that the output of the algorithm could take. 9 Consider the following sequence of steps: 1. Input a non-negative integer n 2.io 3. While n is even do 3.1. nen/2 3.2. ifi +1 4. Output i (a) What is the output when 12 is input? (b) What is the output when any odd number is input? (c) What happens when 0 is input? (d) Is this sequence of steps an algorithm

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!