104k views
5 votes
Write a program that utilizes a loop to read a set of five floating-point values from user input. Ask the user to enter the values, then print the following data: Total Average Maximum Minimum Interest at 20% for each original value entered by the user. Use the formula: Interest_Value = Original_value + Original_value*0.2

User Toto
by
4.8k points

1 Answer

1 vote

Answer:

Python code is given below

Step-by-step explanation:

# create an empty array

arr = []

# loop 5 times

for i in range( 0 , 5 ):

x = float(input('Enter a number : '))

# add x to arr

arr.append( x )

sum = 0

# find the sum of all elements in arr

for x in arr:

sum += x

# calculate average

average = sum / len(arr)

print('\\%15s %15s\\' %('Original Value' , 'Interest Value'))

for Original_value in arr:

# calculate interesr value

Interest_Value = Original_value * 0.2

print('%10f %15f' %( Original_value , Interest_Value ))

print('\\Total :', sum)

print('Average :', average)

print('Maximum :', max(arr))

print('Miniimum :', min(arr))

User Nareshkumar
by
4.9k points