Given 3 floating-point numbers. Use a string formatting expression with conversion specifiers to output their average and their product as integers (rounded), then as floating-point numbers. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
print('%0.2f $ your_value)
Ex: If the input is:
10.3
20.4
5.0
the output is:
11 1050
11.90 1050.60

Answer :

Limosa

Answer:

Following are the program in the Python Programming Language.

#get input from the user

x = float(input())

#get input from the user

y = float(input())

#get input from the user

z = float(input())

#find the average  

average =(x+y+z)/3

#find the product  

product = x*y*z

#print the result in given format

print('\n%d %d'%(average,product))

#print the result in given format

print('%0.2f %0.2f'%(average,product))

Explanation:

Following are the description of the program:

  • We set three variables 'x', 'y', and 'z' that accept float type values from the user.
  • Then, set variable 'average' that store the average of the following values that is given by the user.
  • Set variable 'product' that store the multiplication of the following values that is given by the user.
  • Finally, we print the average and the product in the following format  that is given in the statement.

Other Questions