This Python program reads an integer from the user and calculates the average between that number and zero.
The result is displayed with two decimal places.
# Read a number from the user
num = int(input("Enter a number: "))
# Calculate the average between num and 0
average = (num + 0) / 2
# Display the result
print("\n--- Result ---")
print(f"Average between {num} and 0: {average:.2f}")
Enter a number: 55
--- Result ---
Average between 55 and 0: 27.50
- The user enters a number
- The program adds the number to zero and divides by 2
- The result is printed with two decimal places