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
Art [367]
4 years ago
14

Given an array temps of doubles, containing temperature data, compute the average temperature. Store the average in a variable c

alled avgTemp, which has already been declared. 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 .
Computers and Technology
1 answer:
oksian1 [2.3K]4 years ago
4 0

Answer:

#include <iostream>

using namespace std;

int main() {

   double temps[10]={32.2,30.1,33.5,32.8,35.0,36.7,36.8,35.6,34.9,36.9};//initialized 10 temps values.

   double avgTemp,total=0;//two varaibles declared.

   for(int k=0;k<10;k++)//for loop to calculate the average..

   {

       total+=temps[k];//adding temperature values to the total..

   }

   avgTemp=total/10;//calcualting the average..

   cout<<"The average temperature is "<<avgTemp<<endl;//printing the average temperature.

return 0;

}

Output:-

The average temperature is 34.45.

Explanation:

The above written code is in C++. An array of double temps is initialized with arbitrary 10 values.Then the average is calculated using the integer k and the average is stored in the variable avgTemp. Then it is printed on the screen.

You might be interested in
Whats difference between DCE AND DTE serial interface
harina [27]

DCE stands for data circuit-terminating, data communications, or data carrier equipment - this is a modem or more generally, a line adapter.

DTE stands for data terminal equipment which generally is a terminal or a computer.

Basically, these two are the different ends of a serial line.

7 0
3 years ago
If a code word is defined to be a sequence of different letters chosen from the 10 letters A, B, C, D, E, F, G, H, I, and J, wha
netineya [11]

Answer:

The answer is 6:1 .

Explanation:

We don't need to have prior knowledge of combination or permutation.

Count the way to chose 4 letters.As given in the question chose sequence of different letters

For first place we have 10 letter

For second place we have 9 letter as one is already out

For 3 place we have 8 letter as two letter are already out

For 4 place we have 7 letter as three letter are already out

Total group of 4 letters = 10 * 9 *8*7

Similarly form group of 5 letters we have

Total group of 5 letters = 10 * 9* 8 * 7*6

then Calculating ratio between 4 and 5

We have,

Group 5 : Group 4 ::10 * 9* 8 * 7*6:10 * 9 *8*7

                              : : 30240 : 5040

divide by 5040 on both side we get

Group  5: Group 4 :: 6 : 1

5 0
3 years ago
What may happen if a larger number of computer users are attempting to access a Web site at the same time that u r??? I think it
Semmy [17]
I think if a large number are accessing at the same time you would have to wait for many to clear up

3 0
3 years ago
The word wrap feature
elixir [45]

Answer:

automatically moves the text to the next line if necessary

8 0
3 years ago
Read 2 more answers
In what decade did the Internet begin to be used widely by the public and not just government entities?
Allisa [31]
In the 1980's the internet was open to the public
But it wasn't until the 2000's that it started to be widely used
Your answer is C 2000's
3 0
3 years ago
Read 2 more answers
Other questions:
  • If needed, you can pull over on the shoulder of the freeway to take a break if you are tired. true or false (drivers ed) need as
    11·1 answer
  • On the Excel Ribbon, click the Data tab in the Sort &amp; Filter Group, and then click the Sort button to conduct a _____ sort.
    8·1 answer
  • In what ways was the first Mac OS different from the operating systems used by most early PCs? Users clicked on pictures to laun
    12·1 answer
  • Why is ice even more dangerous than snow
    9·2 answers
  • The mac group does not replace the primary functions of eocs or other dispatch organizations. True or False
    8·1 answer
  • a) Write out an abstract class to represent a ball. Include data fields to store the weight of the ball as a double value and th
    6·2 answers
  • Self-disclosure is most likely to occur _____________.a.
    7·2 answers
  • An object's state is defined by the object's
    6·1 answer
  • JKJKNJJNJJJLKN;K;L;LHNL;BJ
    5·2 answers
  • We initialize the parameters to all zero values and run the linear perceptron algorithm through these points in a particular ord
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!