209k views
2 votes
Write a program that asks for five test scores. The program should calculate the average test score and display it. The number displayed should be formatted in fixed-point notation, with one decimal point of precision.

Here is one sample run:

Enter five test scores: 84 75 90 88 96

Average=86.6

1 Answer

2 votes

Final answer:

The question relates to writing a program for calculating the average of five test scores. A Python code example provided calculates the average and displays it in fixed-point notation with one decimal point of precision.

Step-by-step explanation:

To write a program that calculates the average of five test scores, you can use any programming language such as Python, Java, or C++. Below is an example of such a program written in Python:


# Ask for five test scores
test_scores = input("Enter five test scores: ").split()
# Convert each score to an integer and compute the sum
total_score = sum([int(score) for score in test_scores])
# Calculate the average score
average_score = total_score / 5
# Display the average, formatted to one decimal place
print("Average={:.1f}".format(average_score))

This script prompts the user to enter five test scores, calculates the average, and displays it in fixed-point notation with one decimal point of precision.

User Juan C
by
8.7k points