1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
wlad13 [49]
3 years ago
5

Write in C. Given an array temps of double, containing temperature data, and an int variable n that contains the number of eleme

nts in temps: Compute the average temperature and store it in a variable called avgTemp. Besides temps, n, and avgTemp, you may use only two other variables -- an int variable k and a double variable total, which have been declared.
Computers and Technology
1 answer:
Doss [256]3 years ago
4 0

Answer:

#include <stdio.h>

int main()

{  

   int n = 5;

   double temps[5] = {10.1, 6.4, 14.9, 8.8, 9.2};

   

   double avgTemp, total = 0;

   

   for (int k=0; k<n; k++) {

       total += temps[k];

   }

   avgTemp = total / n;

   

   printf("%lf", avgTemp);

   return 0;

}

Explanation:

Initialize the variables as described in the question

Create a for loop that iterates through the temps array

Inside the loop, add the temperature values in temp to the total

When the loop is done, calculate the average - divide the total by n

Print the average

You might be interested in
How ict tools changed the way we live explain it​
laiz [17]

Answer:

How does ICT change our way of living?

ICT has contributed a lot to change our everyday life such as letter to e-mail, market shopping to on-line shopping, classroom learning to e-learning, etc. This paper present's the effects of ICT as Home and Domestic Activities, Social Networking, Education, Health, Commerce, Banking, and Employment.

5 0
2 years ago
Al encender manda un mensaje de que Windows se cerró de manera inesperada y da varías opciones pero se elige la que sea, regresa
vagabundo [1.1K]

Answer:

6

Explanation:

4 0
3 years ago
_____ crime involves the use of computers and the internet to commit acts against people, property, public order, or morality. v
den301095 [7]
Hi,


Answer => Cyber


Good Lessons
6 0
4 years ago
What are the best 3 xbox 360 games ?​
Andru [333]
Halo
GTA
Call of duty
5 0
4 years ago
Read 2 more answers
The procedure in which a film simulation of a skilled performance is stopped and the person is asked to indicate the outcome of
astraxan [27]
Your answer is:
temporal occlusion procedure

I hope this helps! :)
6 0
3 years ago
Other questions:
  • Is it better to meet online or offline<br> (Please answer QUICK)<br><br> Thanks :')
    5·2 answers
  • What are the benefits of maintaining you vehicle?
    11·1 answer
  • State and derive the law of conservation of energy​?
    8·2 answers
  • Tim is creating a page to display his poker club’s set of rules. He has main categories and subcategories along with about a par
    12·1 answer
  • 1. Write a while loop that lets the user enter a number. The number should be multiplied by 10, and the result assigned to a var
    8·1 answer
  • Secure shell (SSH) operates over which port by default
    9·1 answer
  • What episode and Season of Simpsons is this
    10·1 answer
  • How have newspapers and magazines adapted to digital technology?
    14·1 answer
  • Why header files are needed in every c program ?expalin​
    14·1 answer
  • Which statements are TRUE about web services protocols? (Select TWO responses) SOAP and REST are both web service communication
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!