Write a program to find average of three numbers.
Question
Write a program to find average of three numbers.
✨ Free AI Tools for You
Powered by Chatterbot AI
Answer
Below is a Python program to find the average of three numbers:
# Program to find the average of three numbers
# Input three numbers
num1 = float(input("Enter first number: "))
num2 = float(input("Enter second number: "))
num3 = float(input("Enter third number: "))
# Calculate the average
average = (num1 + num2 + num3) / 3
# Print the result
print("The average of the three numbers is:", average)
Explanation:
Input three numbers: Takes three numbers as input from the user and converts them to float data type.
Calculate the average: Sums the three numbers and divides by 3 to find the average.
Print the result: Outputs the calculated average to the screen.
India's 1st AI Doubt Solver for CBSE, JEE, and NEET
Ask a Question for Freeand then it's just ₹212 a month