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
Demand is created through meeting customer buying criteria, credit terms, awareness (promotion) and accessibility (distribution)
tankabanditka [31]

Answer:

Bell

Explanation:

In the given case the product that has the highest Dec. Cust. Survey score will be treated as most competitive at the end of last year. Based on the information provided in the "Top Products in Thrift Segment" table, we can conclude that Bell has highest score for Dec. Cust. Survey score which stands at 31.

Please see attachment for the product list we referenced to as non was given.

7 0
3 years ago
Type the correct answer in the box. Spell all words correctly.
Kamila [148]

Answer:emphasis

Explanation:

7 0
2 years ago
Shadow and highlight create depth (3D).<br> TRUE OR FALSE
tamaranim1 [39]

Answer:

true because then it would be like not popping out

7 0
2 years ago
The presentation ____ determines the formatting characteristics of fonts and colors.
leonid [27]
The presentation theme determines the formatting characteristics of fonts and colors.
6 0
3 years ago
Read 2 more answers
What is the use of consonant in QBASIC ? Answer me in short and easy answer.​
Digiron [165]

Answer:

See Explanation

Explanation:

I'll assume the question is about the use of constants in QBasic because consonants do not have any special function or usage in QBasic.

In simple terms: In QBasic, constants are used to represent elements that do not change in value during program execution.

Take for instance, you intend to use \pi in your program.

Its value is \pi = 3.142

So, 3.142 will always be a constant in your program. One of the ways it can be used in a program is:

10 LET PI = 3.142

<em>The above represents a numeric constant. QBasic also have string constants.</em>

3 0
3 years ago
Other questions:
  • I only want someones opinion on this not anything you would find in a book.
    7·1 answer
  • In a database, __________ is used to uniquely identify each record for retrieval or manipulation. answer an attribute or a field
    7·1 answer
  • Ashley works for a movie theater. The theater has decided to host some special events over the summer. She needs to communicate
    8·2 answers
  • This is in government
    15·1 answer
  • Think about some of the most memorable and forgettable games ever created. They can be games that were
    15·1 answer
  • Can someone please give me example of three types of loop in pascal (It has to has randomize in it too)
    15·1 answer
  • What is human data,
    8·1 answer
  • When measuring processor speed,a megahertz is much faster than a gigahertz.true or fals
    12·1 answer
  • Is this code object-oriented, or is it procedural? what clues in the code itself did you use to determine what kind of code it i
    14·1 answer
  • Select the correct answer. Which step references adding color, size, and media format in your digital portfolio? A. identifying
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!