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
IgorC [24]
3 years ago
9

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.NOTE: just write the for loop header; do not write the loop body itself.
Computers and Technology
1 answer:
hram777 [196]3 years ago
3 0

Answer:

for (i = lo, result = 0; i <= hi; result += i, i++) {}

Explanation:

A for loop header has three statements:

  1. <em>i = 0, result = 0;     </em>This statement initializes <u>i</u> and <u>result</u> variables with 0. It is executed only once at the very start of the for loop.
  2. <em>i <= hi;</em>     This statement is executed after the first statement and again after the execution of code in body of the loop.
  3. <em>result += i, i++</em>     This statement is executed after the execution of code in body of the loop but before the execution of second statement.

Therefore, the following sequence of events will occur:

  • The result variable is initialized with 0 at start.
  • Then, the condition is checked. If the value of i will be less than or equal to the value of hi, the third statement will be executed.
  • The third statement will add the value of i to the value of result and then increase the value of i by 1.
  • Then, again the condition in second statement will be checked.

This loop will be executed for as long as the condition remains true.

You might be interested in
Group of programs are software ​
Cloud [144]

Answer:

No

Explanation:

a single program or application is a software

3 0
3 years ago
Read 2 more answers
What is one reason why a business may want to move entirely online?
Sidana [21]

Answer:

The correct answer is C. One reason why a business may want to move entirely online is to focus on a global market.

Explanation:

The fact that a business wishes to move entirely towards the online sales modality implies that there is a desire to expand the possibilities of selling its products beyond the physical place where it has its store.

It is a reality that starting an online business implies that the offered product can be purchased anywhere in the world, thanks to advances in technology and transportation that allow the product to be purchased and delivered in a matter of days, thanks to the advances produced by globalization.

Therefore, the fact that the store goes from physically to online selling makes its potential customers go from being the ones who know the store and live close to it to everyone in the world with access to internet.

3 0
3 years ago
I love science its my favorite subject
Charra [1.4K]

Answer:

Nice!

Explanation:

i like physics and biology :)

4 0
3 years ago
Read 2 more answers
A Java programmer has developed a GUI with several different fields for inputting values and indicating choices via buttons, all
stiks02 [169]

Answer:

EventHandler

Explanation:

In order to do this the programmer needs to use the EventHandler class. This class allows the computer to listen for certain user actions such as pressing a button. Using this on a button would then allow the programmer to specify what they want to happen when the user clicks the button or performs a certain action. For example, in this scenario, the programmer would program an EventHandler so that when the button is clicked it saves the input to a variable and changes the input field to the next option.

3 0
3 years ago
Which class of fire extinguisher is appropriate for a fire involving electrical/energized electrical equipment?
krok68 [10]
The answer would be a C class fire extinguisher. 
6 0
3 years ago
Read 2 more answers
Other questions:
  • I plugged my phone up into a charger, the charger sparked and i unplugged my phone and now it wont charge at all, does anyone kn
    13·1 answer
  • You disassemble and reassemble a desktop computer. when you first turn it on, you see no lights and hear no sounds. nothing appe
    11·2 answers
  • A manager wants to set up an area that is not on the LAN but not quite on the Internet. This area will house servers that will s
    5·1 answer
  • On laptops with a smart card reader installed, where is the smart card reader usually located?
    13·1 answer
  • Examine the following algorithm.
    9·1 answer
  • Which statement best describes what happen to the temoporary working memory (RAM) of a computer when it shut down
    12·2 answers
  • Which osi/iso layer is responsible for determining the best route for data to be transferred?
    5·1 answer
  • A desktop computer (named workstation22) can’t connect to the network. A network card was purchased without documentation or dri
    15·1 answer
  • In cell B13, create a formula without a function using absolute references that subtracts the values of cells B5 and
    13·1 answer
  • Write a program that estimates how many years, months, weeks, days, and hours have gone by since Jan 1 1970 by calculations with
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!