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
nevsk [136]
3 years ago
15

Assume the int variables i, lo, hi, and result have been declared and that lo and hi have been initialized. Write a for loop tha

t adds the integers between lo and hi (inclusive), and stores the result in result. Your code should not change the values of lo and hi. Also, do not declare any additional variables -- use only i, lo, hi, and result.
Computers and Technology
1 answer:
IRISSAK [1]3 years ago
4 0

Answer:

result=0;

for (i=lo ; i<=hi; i++){

result += i;

}

Explanation:

The question says result was declared but not initialized, so using result without initializing it to 0 would throw an error as result would be undefined and you can't add a number to undefined

Another way to do it to keep everything inside the loop would be

for (i=lo ; i<=hi; i++){

if (i==lo) result= 0;

result += i;

}

but this is impractical since it would add unnecesary operations in each cycle of the loop

You might be interested in
A technician removes the cap from the brake fluid reservoir and finds that the rubber boot in the cap is swollen. technician a s
uysha [10]

Technician A is correct, there could be water or other contaminant in the brake fluid reservoir. The swollen cap needs to be replaced, some sell only the rubber part of the cap which could help save you money.

5 0
3 years ago
Which layer of the OSI model provides a user interface in the form of an entry point for programs to access the network infrastr
Alexandra [31]

The OSI model layer that provides a user interface in the form of an entry point for software programs to access the network infrastructure is: application layer.

<h3>What is the OSI model?</h3>

OSI model is an acronym for open systems interconnection and it comprises seven (7) main layers, which typically starts from the hardware layers (layers in hardware systems) to the software layers (layers in software systems)

<h3>The layers of the OSI model</h3>

In Computer networking, the seven (7) layers of the OSI model include the following in sequential order;

  • Physical Layer
  • Data link Layer
  • Network Layer
  • Transport Layer
  • Session Layer
  • Presentation Layer
  • Application Layer

The uppermost layer of the OSI model which is the "application layer" gives software programs an access to the services that allow internet connection or network infrastructure.

Read more on OSI model here: brainly.com/question/14446612

3 0
2 years ago
Develop a program that will calculate the area and perimeter of a rectangle. The length and width can be given as constant.(LENG
o-na [289]

Answer:

#include <iostream>

using namespace std;

int main()

{

 

  int length = 8;

  int width = 8;

 

  int perimeter = 2*(length + width);

  int area = length * width;

 

  cout<<"The perimeter is "<<perimeter<<endl;

  cout<<"The area is "<<area<<endl;

 

  return 0;

}

Explanation:

include the library iostream for using the input/output instructions in the c++ programming.

Create the main function and define the variable length and width with values.

Then, use the formula for calculating the perimeter and area of rectangle.

perimeter = 2*(length + width)

area = length * width

and store in the variables and finally print the output.

8 0
3 years ago
Which of the following are characteristics of global variables? Check all that apply.
algol [13]

Answer:

A and D

Explanation:

took the test

7 0
3 years ago
Read 2 more answers
Physical activity such as sports or even a brisk walk can help reduce
ycow [4]
Physical activity could help reduce the chance ofheart disease
4 0
3 years ago
Read 2 more answers
Other questions:
  • After calling the customer service line of Delta airlines, Francis received an email asking her to fill out customer satisfactio
    9·1 answer
  • The system administrator in your office quits unexpectedly in the middle of the day. It's quickly apparent that he changed the s
    10·1 answer
  • Can someone help me to give this guy brainliest the button is not there
    8·1 answer
  • In this question, you must create a function in C++ using an external editor. When satisfied with your work, you shall attach it
    10·1 answer
  • The idea that innovations in transportation and communication technologies has changed the way we think about distance and time
    9·1 answer
  • All of the following are examples of being computer literate, EXCEPT ________. Group of answer choices knowing how to build and
    7·1 answer
  • Why do we need IP Addresses in order for the Internet to function properly?
    7·1 answer
  • What Is the Purpose of a Web Browser? *<br><br>​
    7·2 answers
  • Pls say correct guyz pls pls pls
    7·1 answer
  • Which type of measurement would you use to determine the mass of sugar?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!