Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Discrete math for computing image text in transcribed
image text in transcribed
please show clear work
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Analysis Using SQL And Excel

Authors: Gordon S Linoff

2nd Edition

111902143X, 9781119021438

More Books

Students also viewed these Databases questions

Question

6. Is all Internet training the same? Explain.

Answered: 1 week ago