Given three floating-point numbers x, y, and z, output x to the power of y, x to the power of (y to the power of z), the absolute value of x, and the square root of (xy to the power of z). Ex: If the input is 5.0 6.5 3.2, the output is: 34938.56214843421 1.2995143401732918e+279 5.0 262.42993783925596 Hint: Coral has built-in math functions (discussed elsewhere) that may be used.

Respuesta :

Answer:

float x

float y

float z

x = Get next input

y = Get next input

z = Get next input

Put RaiseToPower(x, y) to output

Put "\n" to output

Put RaiseToPower(x, RaiseToPower(y, z)) to output

Put "\n" to output

Put AbsoluteValue(x) to output

Put "\n" to output

Put SquareRoot(RaiseToPower(x*y, z)) to output

Explanation:

The first three lines of code is simply declaring the data type of the x, y and z variables which was declared as float type meaning number with decimal points.

The next three lines after the first three lines is getting the input from the user

In coral, we use Put <expression> to output to display <expression> to the console

For the first Put statement, I am telling the interpreter to display the value of x raised to the power of y to the console by using Coral's RaiseToPower built-in math function

The Put "\n" to output statement scattered in the snippet is just for formatting reasons so that each result will be displayed in a newline

The next computation RaiseToPower(x, RaiseToPower(y, z)) is a bit nested but  it is actually doing this: [tex]x^{y^{z} }[/tex]

The next computation is AbsoluteValue(x) is doing this [tex]|x|[/tex]

And the final computation SquareRoot(RaiseToPower(x*y, z)) is doing this:

[tex]\sqrt{(xy)^{z} }[/tex]