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
You can use a(n) ______________to store large amounts of customer data for a website.
BaLLatris [955]

You can use a(n) <u>database server; Databases, like MySQL</u><u> and PostgresSQL, are widely used to store data.</u>to store large amounts of customer data for a website.

<h3>What is the difference between POP3 and IMAP coursera?</h3>

POP3 can only download email to one local device. IMAP can only download email to one local device. POP3 is used for sending emails. IMAP can download emails onto multiple devices.

<h3>When would you use IMAP?</h3>

IMAP and POP are two methods to access email. IMAP is the recommended method when you need to check your emails from several different devices, such as a phone, laptop, and tablet.

To learn more about database server, refer

brainly.com/question/23752341

#SPJ4

5 0
1 year ago
What is blockchain? How it works? I heard bitcoin uses it.
igor_vitrenko [27]
Https://www.toptal.com/bitcoin/blockchain-technology-powering-bitcoin
i dont have the time to read it right now, but i was able to find you this link that should hopefully help- you out!
6 0
3 years ago
Effective communication skills are a desirable workplace skill
OLga [1]
Yes. If there is no effective communication in the workplace then nothing is going to be done.
4 0
3 years ago
Which contact field is used to control the name that would appear in the To field of an email message when a user is sending a m
ser-zykov [4K]

Answer:

Display as

Explanation:

Need the same question, but that's my guess, because display, means to show.

3 0
2 years ago
Read 2 more answers
Bill Schultz works at a high power investment firm in Los Angeles. Bill is responsible for promoting the firm's vision and creat
Anna35 [415]

Answer:a

Explanation:

4 0
3 years ago
Other questions:
  • A) What is the maximum value that can be represented as an unsigned n-bit binary integer?
    13·1 answer
  • True or false? A medical assistant can check for available exam rooms and providers using an electronic scheduling system.
    8·1 answer
  • An algorithm written out in plain English statements is called __________.
    8·1 answer
  • This type of software works with end users, application software, and computer hardware to handle the majority of technical deta
    12·1 answer
  • jeff wants to create a website with interactive and dynamic content. Which programming language will he use?
    11·2 answers
  • Your organization uses a type of cryptography that provides good security but uses smaller key sizes and utilizes logarithms tha
    9·1 answer
  • Please choose the correct citation for the case which established the "minimum contacts" test for a court’s jurisdiction in a ca
    10·1 answer
  • What is the difference of using Selection Tool and Direct Selection Tool?
    6·1 answer
  • What kinds of new input devices do you think might be invented in 10, 20, or 50 years? How might those devices change the world?
    9·1 answer
  • Compare mini and mainframe computer in terms of speed,memory and storage​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!