213k views
5 votes
Using math functions Given three floating-point numbers x, y, and z, output x to the power of z, x to the power of (y to the power of z), the absolute value of (x minus y), and the square root of (x to the power of z). Output each floating-point value with two digits after the decimal point, which can be achieved as follows: print('{:.2f} {:.2f} {:.2f} {:.2f}'.format(your_value1, your_value2, your_value3, your_value4)) Ex: If the input is: 5.0 1.5 3.2

the output is: 172.47 340002948455826440449068892160.00 6.50 262.43

User ScootyPuff
by
6.2k points

1 Answer

2 votes

Answer:

import math

x = float(input())

y = float(input())

z = float(input())

value1 = pow(x, z)

value2 = pow(x, pow(y, z))

value3 = abs(x - y)

value4 = math.sqrt(pow(x, z))

print('{:.2f} {:.2f} {:.2f} {:.2f}'.format(value1, value2, value3, value4))

Step-by-step explanation:

*The code is in Python.

Ask the user to enter x, y, and z as floating point numbers

Calculate the each expression using math functions, pow - calculates the power, abs - calculates the absolute value, and sqrt - calculates the square root

Print the values in required format

Note that the given output is not correct. It must be:

172.47 361.66 3.50 13.13

User Hilaj S L
by
6.8k points