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 camera required the photographer to project the image on paper
MakcuM [25]

Answer: A polaroid

Explanation: I have all these cameras

7 0
3 years ago
Read 2 more answers
Which of the following is NOT a strength of monetary policy?
ipn [44]

your answer is b to the question


6 0
3 years ago
________ is a password-cracking method wherein the attacker compares passwords to lists of common words.
Dmitriy789 [7]
Hi!

When someone repeatedly compares passwords to lists of common words, this is known as the dictionary attack.

We call it this because they are <em>literally </em>using a dictionary to attack you!

Hopefully, this helps! =)
7 0
3 years ago
Point mode allows you to select cells for use in a formula by using your finger or the pointer
Serga [27]
That statement is true

in excel, you could enter point mode by pressing any keyboard navigation such as page down, page up, or the arrow keys or by clicking any cells in the worksheet

This mode will select a cell or range as formula operand


7 0
2 years ago
When you divide a picture into thirds, how many parts do you end up with? *
lara31 [8.8K]

Answer:

3

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • 1. Why is it important to compare features of a computer before making a purchase?
    13·2 answers
  • Summary In this lab, you declare and initialize variables in a C++ program. The program, which is saved in a file named NewAge.c
    5·1 answer
  • Nikolas has a idea that he could use the compressed carbon dioxide in a fire extinguisher to propel him on his skateboard. Nikol
    13·2 answers
  • Which of these ia an example of gene flow?
    5·1 answer
  • ____ occurs when two nodes simultaneously check a channel, determine that it is free, and begin to transmit.
    9·1 answer
  • Consider the relational schema below: Students(sid: integer, sname: string, major: string) Courses(cid: integer, cname: string,
    9·1 answer
  • MEOWWWWWRARRARARARARRA
    5·1 answer
  • Political parties to address the interest of civil society<br>​
    7·1 answer
  • Write a program that asks the user for the name of a text file. The program should display the first 10 lines of the file on the
    6·1 answer
  • What technology would a bank's website use a scramble information as it is transmitted over the Internet
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!