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
Which term refers to the science that specifies the design and arrangement of items you use so you interact with the items effic
sashaice [31]

Answer:

the ergonomics To prevent a laptop from being stolen, you can use a surge protector. False; To prevent laptops from being stolen, you can use a cable lock. What is a digital certificate?

6 0
2 years ago
If you must use a credit card while in college what are some ways you can keep from getting in credit card debt?
marin [14]

Answer:

Pay attention to what you buy and limit yourself to an amount of money everyday.

Explanation:

This is just a simple way from spending a lot and limits your everyday spendings when you actually leave an amount for yourself.

3 0
4 years ago
Want is the assignmment
AnnZ [28]
Can you explain this
4 0
3 years ago
When preparing a photo for a magazine, a graphic designer would most likely need to use a program such as Microsoft Excel to kee
UNO [17]

Answer:

Adobe Photoshop To Manipulate The Photo.

Explanation:

BLACKPINKS new album is amazing OMG I LOVE Lovesick Girls!!!

3 0
3 years ago
8.6 Lesson Practice edhesive
scoundrel [369]

Incomplete question. I could only infer you are possibly referring to edhesive unit 8 questions. Here are a few sample questions;

1. Where does Python start?

2. To create the body of a function, we ____________ the code.

Answer:

1. Main Section

2. Indent

Explanation:

1. It is a common rule in Python programming language when coding for for it to begin at the first part of the Main Section.

2. Indenting a code involves creating space or jumping a line away from the margin of the text dialogue box, thus the code written there becomes the body of the function.

8 0
4 years ago
Other questions:
  • What is an example of asynchronous communication
    7·1 answer
  • One way to describe the note-taking tool eNotes is to call it an<br> Someone help ._.
    9·2 answers
  • Which of the following techniques has to do with how the people who make the commercial manipulate the way it looks?
    8·1 answer
  • The most commonly used video formats are the mpeg-____ format, the windows media audio/video format, and the audio visual interl
    12·1 answer
  • Sarah's employer purchased a health insurance plan that costs $750 per month. Sarah pays $75 toward the plan each month. What is
    5·2 answers
  • Write a statement to add the key Tesla with value USA to car_makers. Modify the car maker of Fiat to Italy. Sample output for th
    9·1 answer
  • Please help I’ll give you 10 points
    8·2 answers
  • Which part of the water cycle is most affected by a sunny day with few clouds?
    5·2 answers
  • Topic: Video Games.
    7·1 answer
  • please help me out i’ll give you brainlist
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!