Question: Discrete math for computing please show clear work 6 numbers and test whether magnitude, giving an Write an algorithm to input a list of numbers

6 numbers and test whether magnitude, giving an Write an algorithm to input a list of numbers and the numbers are in increasing order of magnitude appropriate message as output. The algorithm shoul designed so that testing stops as soon as the answer isk Modify the algorithm in Example 1.3.1 so that it gives + output when n=0 is input. latae a number line so that it gives the correct Example 1.3.1 Design an algorithm to evaluate x", where x is any real number and n is a positive integer. (Assume that the operation of multiplication is available, but raising to a power is not; this is the case, for example, in the programming language Pascal.) Solution If n is a positive integer, x" can be evaluated using the formula: x = xxxX...XX n times In order to carry out this process, we will need a variable answer, which is initially assigned the value of x, and which is then multiplied by x the required number of times. The number of multiplications is fixed at n-1, so a For-do loop is the most appropriate control structure to use here. 1. Input x, n 2. answer X 3. For i = 1 to n - 1 do 3.1. answer answer xx 4. Output answer rithm? The stens are clear and
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
