Question #143307

Write a structured algorithm to prompt the user to input the ages of four friends. The algorithm should allow the user to input the ages, find and print the average.

Expert's answer

For example, the algorithm in Python may look like this:

a = int(input("How old is your first friend? "))
b = int(input("How old is your second friend? "))
c = int(input("How old is your third friend? "))
d = int(input("How old is your fourth friend? "))
average = ((a+b+c+d)/4)
f = round(average, 2)
print("The average age of your friends is", f, "years")
LATEST TUTORIALS
APPROVED BY CLIENTS