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
grandymaker [24]
3 years ago
9

Write the definition of a void function that takes as input two integer values, say n and m. The function returns the sum and av

erage of all the numbers between n and m (inclusive).
Computers and Technology
1 answer:
hodyreva [135]3 years ago
7 0

Answer:

void mn(int m, int n){

   int sum = 0;

int count = 0;

   if(m<n){

       for(int i = m;i<=n;i++){

           sum+=i;

       }

   }

   else{

       for(int i = n;i<=m;i++){

           sum+=i;

       }

   }

count = abs(m - n)+1;

   cout<<"Sum: "<<sum<<endl;

   cout<<"Average: "<<(float)sum/count;

}

Explanation:

This line defines the method

void mn(int m, int n){

This initializes sum and count to 0

   int sum = 0;

int count = 0;

This checks if m is less than n

   if(m<n){

This iterates from m to n and calculates the sum of numbers between this interval

<em>   for(int i = m;i<=n;i++){</em>

<em>            sum+=i;</em>

<em>        }</em>

<em>    }</em>

If otherwise,

   else{

This iterates from n to m and calculates the sum of numbers between this interval

<em>        for(int i = n;i<=m;i++){</em>

<em>            sum+=i;</em>

<em>        }</em>

<em>    }</em>

This calculates the range from m to n using absolute function

count = abs(m - n)+1;

This prints the calculated sum

   cout<<"Sum: "<<sum<<endl;

This calculates and prints the average

   cout<<"Average: "<<(float)sum/count;

}

<em>See attachment for complete program that includes the main (in c++)</em>

Download cpp
You might be interested in
Notice that the percentages range from just over 55% to just under 65%. This is a range of 10%, so we're going to use 5 evenly-s
vfiekz [6]

Answer:

import numpy as np

l_int = 55/100

h_int = 65/100

hist = np.histogram( paid_tax_preparers_list, bins=5, range=(l_int, h_int))

Explanation:

Numpy is a Python package used to ease mathematical and statistical research calculations. The package creates data structures called arrays that can be used as vector items, making it easy and fast for calculation to be done.

The np.histogram method is used to create or plot histograms of a list or array against the frequency of the items in the array. The bins and the range attributes are used to adjust the display of the histogram, with bins being the number of bin in the graph and range is the given length of the histogram.

7 0
3 years ago
Can some one help please
quester [9]

Answer:

I think its screenplay

Explanation:

Firstly, the question starts with an a so it can't be b. And format can't be repeated. Which leaves us with screenplay.

Hope this helps.

8 0
1 year ago
Attackers have recently launched several attacks against servers in your organization’s DMZ. You are tasked with identifying a s
kari74 [83]

Answer:

Option B is correct.

Explanation:

Well into the DMZ corporation of the user, intruders have currently conducted numerous attempts toward networks. He is associated with finding any response which would provide the greatest opportunity in the future to avoid such threats.  

The in-band IPS becomes the better approach for the required choices. Traffic moves via the IPS, as well as it has a better probability of avoiding inner processes through entering invasion.

4 0
3 years ago
While recording a voice, if the narration is large,it is better to make a :a)a linked object b)an embedded object c)none d)does
goldenfox [79]

Answer:

c)none

Explanation:

Automatic updates can be a great problem in the case of the linked object and an embedded object. Hence, "a" and "b" are not the correct options, and since there is an effect, the d. the option is also not correct, as it does affect. And hence none of these options are correct. And the correct option is c) none.

4 0
3 years ago
Briefly discuss the aesthetics and ergonomics of a hydraulic jack. First explain what these
ehidna [41]

Answer:

For this model, aesthetics is defined as a measure of how attractive a product appears, and ergonomics is how well a product feels when used/held. ... Two important types of defects, part flash and crush, will be used to define ergonomic and aesthetic PA's, respectively.

5 0
3 years ago
Other questions:
  • Select one of the following strategies: active listening, sandwich technique, constructive feedback. in 2-5 paragraphs, define a
    11·1 answer
  • We are building a word processor and we would like to implement a "reflow" functionality that full-justifies text.Given a maximu
    12·1 answer
  • Are video games a viable source of income if you’re good at them
    10·1 answer
  • This exercise shows why each pivot (in eli1nination by pivoting) must be in a different row. (a) In Example 7, make the third pi
    15·1 answer
  • Credible sites contain __________ information,
    7·2 answers
  • We have constructed a Player Class for you. Add the following: public static variable: int totalPlayers Static variable should b
    8·1 answer
  • Why does a computer need memory​
    15·2 answers
  • The web lab consists of which elements. Select all that apply. Group of answer choices Files Inspector Tool Preview Hints Work S
    9·1 answer
  • Which of the following could be a method for an object-oriented class called Student?
    8·1 answer
  • True or false? a router is a network device that directs packets over a network towards their final destination.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!