144k views
2 votes
Coral 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 (x * y to the power of z).

Output all results with five digits after the decimal point, which can be achieved as follows:
Put result to output with 5 decimal places
Ex: If the input is:
5.0 2.5 1.5
the output is:
55.90170 579.32402 5.00000 6.64787
Hint: Coral has built-in math functions (discussed elsewhere) that may be used.

1 Answer

4 votes

Answer:

The program is as follows:

float x

float y

float z

x = Get next input

y = Get next input

z = Get next input

Put RaiseToPower(x,y) to output with 5 decimal places

Put "\\" to output

Put RaiseToPower (x,RaiseToPower (y,z)) to output with 5 decimal places

Put "\\" to output

Put AbsoluteValue(x) to output with 5 decimal places

Put "\\" to output

Put SquareRoot(RaiseToPower (x * y,z)) to output with 5 decimal places

Step-by-step explanation:

This declares all variables

float x

float y

float z

This gets input for all variables

x = Get next input

y = Get next input

z = Get next input

This prints x^y

Put RaiseToPower(x,y) to output with 5 decimal places

This prints a new line

Put "\\" to output

This prints x^(y^z)

Put RaiseToPower (x,RaiseToPower (y,z)) to output with 5 decimal places

This prints a new line

Put "\\" to output

This prints |x|

Put AbsoluteValue(x) to output with 5 decimal places

This prints a new line

Put "\\" to output

This prints sqrt((x * y)^z)

Put SquareRoot(RaiseToPower (x * y,z)) to output with 5 decimal places

User MBozic
by
5.4k points