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
juin [17]
3 years ago
5

You are training to complete in a local 5K run. You record your time scores in minutes after completing seven practice runs. Wri

te a method to calculate and return the average score based on the data.
Computers and Technology
1 answer:
trapecia [35]3 years ago
3 0

Answer:

Following are the program to this question:

#include <iostream>//defining header file

using namespace std;

float Avg(float sum, int n)//defining method Avg that accepts float parameter

{

float average=sum/n;//defining float variable average that holds average value  

return average;//return average

}

int main()//defining main method

{

float ar[ ] = {24.1,24.5,24.4,23.8,28.2,29.1,27.4};//defining float array

float sum;//defining float variable sum

int n=7,i;//defining integer variable  

for (i = 0; i <n; i++)//defining loop to count total of array

{

sum=sum+ar[i];//add value in sum variable

}

cout<<"The average is: "<<Avg(sum,n);//use print method to call and print method return value

return 0;

}

Output:

The average is: 25.9286

Explanation:

In the above code, the float method "Avg" is declared, that accepts two parameters, that is "sum and n", inside the method, a float variable average is declared that divides and returns its values.

In the main method a float array "ar" is declared that holds values, in the next line, float variable "sum" and integer variable "n, j" is used.

In for loop, the "i" variable is used to add array values in the sum variable and pass into cout to call the "Avg" method and print its return value.

You might be interested in
Which is the shortest and simplest tax form? <br> 1040 long form <br> 1040EZ<br> 1040A<br> 140E
Kay [80]
The answer is 1040EZ. That is the shortest and simplest tax form. 
7 0
3 years ago
Read 2 more answers
Which of these sedimentary rocks is made of the largest particles?
Marta_Voda [28]
Your answer is <span>A.conglomerate.

Hope this helps :)</span>
6 0
3 years ago
Plz help
Rama09 [41]

Answer:

name

Explanation:

name =

is an assignment to the variable called 'name'.

5 0
3 years ago
Read 2 more answers
A cell that a user is typing words or numbers into is called the ________  cell.
NeX [460]
Cell content or Content value
7 0
3 years ago
Read 2 more answers
How would you classify an employee who communicates effectively, listens to coworkers, and makes good decisions?
vovikov84 [41]
He is the ideal employee and works correctly
4 0
3 years ago
Read 2 more answers
Other questions:
  • True or false? any webb app can be accessed and run on any computing
    12·1 answer
  • 1. What is the central idea of the section "Service Record." Use two text details to
    8·1 answer
  • How does a hard drive work?
    5·1 answer
  • BEING TIMED HELP ASAP
    12·2 answers
  • Which of these ia an example of gene flow?
    5·1 answer
  • What stores all software and files on your computer and reads and writes data onto a spinning magnetic or optical disk?
    6·1 answer
  • What are some common uses of Excel?
    10·1 answer
  • In which program structure does the processor verify the mentioned condition only after executing the dependent statements once?
    8·2 answers
  • Windows is a GUI Operating System, what is the other type?
    8·1 answer
  • Purpose In this lab activity, you will be introduced to the concept of enriching data with SPLUNK. This three-hour course is for
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!