Ask Question
30 November, 15:05

Given an array temps of doubles, containing temperature data, compute the average temperature. Store the average in a variable called avgTemp. Besides temps and avgTemp, you may use only two other variables - - an int variable k and a double variable named total, which have been declared.

+4
Answers (1)
  1. 30 November, 18:24
    0
    Step-by-step explanation:

    We can code this in python:

    First, calculate the total temperature by iterating through temps by k

    for k in temps:

    total + = k

    Then we can calculate the average by dividing the total by the number of items in the temps array, or the length of array

    avgTemp = total / len (temps)
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Given an array temps of doubles, containing temperature data, compute the average temperature. Store the average in a variable called ...” in 📘 Mathematics if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers