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
What arw two reasons for maintaning your privacy on the internet
Mekhanik [1.2K]

Answer:

so people can't get your information and use it to their advantage and because you never know what people could do with that information

Explanation:

8 0
3 years ago
Read 2 more answers
A document with a(n) ____ guarantees that the document was indeed sent by a specific individual and that it hasn t been tampered
BARSIC [14]
The answer is A) digital signature
8 0
3 years ago
"what is the name of the ipsec configuration file"
kifflom [539]
Ipsec.conf file. This file is found in the /etc/ directory
5 0
3 years ago
Which guideline should you follow when selecting the font for a presentation
Sladkaya [172]
My school requires us to use Arial and double space it but we have to use font size 30 for title and 24 for the paragraphs.
3 0
3 years ago
Jennifer’s company currently uses Windows Active Directory to provide centralized authentication, authorization, and accounting
Vsevolod [243]

Answer:

RADIUS

Explanation:

Remote Authentication Dial-In User Service (RADIUS) is a networking protocol that provides centralized Authentication, Authorization, and Accounting management for users connected to a network service. It can be used to authenticate anyone who is on your network.

RADIUS is a protocol that uses TCP or UDP as transport. RADIUS client is what is used to communicate with RADIUS servers at gateways of the network.

8 0
3 years ago
Other questions:
  • While browsing through the mall, you are given samples of the latest perfumes from different designers. This is an example of wh
    14·1 answer
  • A patent facilitates a government-approved technological monopoly by
    5·1 answer
  • The counter in a for or while loop can have an explicit increment: for i=m:k:n. This advances the counter i by increment k each
    15·1 answer
  • You can count on everything online to be 100% accurate. <br> A. FALSE <br> B. TRUE
    11·2 answers
  • Sarah's Texas location has a server that is starting to give her trouble. It is needing to be restarted frequently and seems to
    15·1 answer
  • Assume that strikeCounter has already been declared to be a "pointer to int". Assume further that strikeCounter has been initial
    7·1 answer
  • How many of the colonists of Jamestown died before they made it to shore, due to the difficult voyage?
    15·1 answer
  • Stephen is looking through some design diagrams created for a specific application. He spots a diagram which uses a parallelogra
    14·1 answer
  • Question 2 of 25
    11·1 answer
  • Which of the following best describes a hotspot as
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!