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
True or False: It is the CISO❝s responsibility to ensure that InfoSec functions are performed within an organization. A) True B)
algol [13]

Answer: True

Explanation: CISO(Chief information security officer) is the officer that is responsible for the information security(Infosec) function to be implemented in the organization.He/she manages the procedures, protect from the threats in business, secures the enterprise communication.

The post of CISO is considered as a senior level officer .The responsibilities of the CISO also includes getting along with other section of the organization and assuring about the smooth and secured processing of the business work as the aspect of information security.Thus the statement given is true

3 0
3 years ago
Fre.....ee p......oint....s pt 2
murzikaleks [220]

Answer:

Thanks for it

Explanation:

Brainlists please

3 0
3 years ago
Read 2 more answers
What are the advantages and disadvantages of using steganography versus symmetric or asymmetric encryption
ankoles [38]

<u>Explanation:</u>

Steganography is a technique used in securing or hiding sensitive information by encrypting the information in a non-hidden file like a JPEG format. A major <u>advantage</u> of this method is that it reduces the risk of attack or break-in since the data is enclosed in a non-secure file; thereby reducing threats of any hack. One main<u> disadvantage</u> of this method is that the hidden message may become difficult to recover if the source file (non-secure file) used, is edited or deleted.

In symmetric or asymmetric encryption they both employ cryptographic encryption method. While symmetric encryption uses one key to encrypt and decrypt data, asymmetric encryption uses two keys (one for encryption, the other for decryption) of the data. <u>A major </u><u>advantage</u><u> of using these methods is that they provide more security. Although while symmetric encryption is faster, asymmetric encryption is slower (eg using separate keys to gain access), </u><u>a disadvantage.</u>

6 0
3 years ago
What are the parts to an
bazaltina [42]

Answer:

B) recipient subject body signature

5 0
3 years ago
What is the purpose of Python’s Turtle Graphic Module?
Iteru [2.4K]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The correct answer to this question is Importing code to draw on the screen.

Python's Turtle Graphic Module is a graphic library in python that used for drawing. By using this library, you can draw various types of shapes and images. For example, you can draw lines, circles, square, and all different shapes using this library.

However, all other options are not correct because:

To calculate simple mathematical equations, you can do it using general programming. But if you want to do complex mathematics then you can Python Math Module but not Python's Turtle Graphic Module.

Also, the turtle graphic library dos not use for gathering input and to something print on the screen.

7 0
3 years ago
Read 2 more answers
Other questions:
  • James, a technician, is tasked to remove the dust inside of a desktop computer.
    7·1 answer
  • In an inheritance situation, the new class that you create from an existing class is known as the:
    5·1 answer
  • Which option should u select to ignore all tracked changes in a document
    8·1 answer
  • To copy cell contents, you can select the cell and then press the ____ keys.
    12·1 answer
  • Name this<br><br>The feature allows you to add text/picture in the background of the document. ​
    11·1 answer
  • Define a member function PrintAll() for class PetData that prints output as follows. Hint: Make use of the base class' PrintAll(
    8·1 answer
  • The space between the margin<br> and start<br> of paragraph is called
    8·1 answer
  • The tags are always enclosed within a pair of<br>(a) curly<br>(b) square<br>(©) angular​
    6·1 answer
  • HELP ASAP. Which of the following is the best example of an installation issue? A computer can’t find the file that it needs to
    7·1 answer
  • What is pseudocode? O A way of describing a set of instructions in text form using plain english O A diagrammatic representation
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!