Write a java program to input temperature for 7 days in an array and display the average temperature of the week
Answers
d1 = float(input("Enter Sunday Temperature: "))
d2 = float(input("Enter Monday Temperature: "))
d3 = float(input("Enter Tuesday Temperature: "))
d4 = float(input("Enter Wednesday Temperature: "))
d5 = float(input("Enter Thursday Temperature: "))
d6 = float(input("Enter Friday Temperature: "))
d7 = float(input("Enter Saturday Temperature: "))
avg = (d1 + d2 + d3 + d4 + d5 + d6 + d7) / 7
print("Average Temperature =", avg)
Output
d1 = float(input("Enter Sunday Temperature: "))
d2 = float(input("Enter Monday Temperature: "))
d3 = float(input("Enter Tuesday Temperature: "))
d4 = float(input("Enter Wednesday Temperature: "))
d5 = float(input("Enter Thursday Temperature: "))
d6 = float(input("Enter Friday Temperature: "))
d7 = float(input("Enter Saturday Temperature: "))
avg = (d1 + d2 + d3 + d4 + d5 + d6 + d7) / 7
print("Average Temperature =", avg)
Explanation :
Plz mark brainliest