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
Once I install my secondary hard drive what two tasks need to be done?
Vlada [557]
What is the use for the secondary hard drive?

If it is to run another operating system, such as a Linux flavour or another version of Windows, you would need to:

1) correctly format your drive

2) Install your OS

If you are using the HDD alongside your current OS, you need to:

1) Lower the boot priority of that drive in your BIOS

2) Format your hdd for use in your OS.

(Use NTFS for Windows and HFS+ for OS X)
3 0
3 years ago
Text rotation is also called _________________.
strojnjashka [21]

Text rotation is also called B. Orientation, in which they change how the page is viewed, commonly portrait or landscape.

hope this helps

8 0
3 years ago
g What differences do you anticipate there being between working inside vs outside City government in data and digital services?
Ivanshal [37]

Answer:

The work with city government is better than outside city government due to the reasons given below.

Explanation:

There are many differences while working in city government or outside city government. I choose city government job in data and digital service due to the following reasons.

  1. City government provides all types of facilities that are required in data management and digital services.
  2. Provision of more benefits along with salary from city government.
  3. City government arrange different training and development sessions for their employ.
  4. There are many learning and development opportunities, because they provide opportunity to work in different departments.  
  5. City Government have better HR policies as compared to outside government.
6 0
3 years ago
Specification of database requirements falls under which category of database​ administration?
enot [183]
Specification of database requirements falls under which category of database​ administration?

b. development
3 0
4 years ago
What actions are considered positive body language?
Ainat [17]

Answer:

Greeting with a smile, open handed gestures, and making eye contact

Explanation:

I used this on E2020 and got it right

5 0
3 years ago
Other questions:
  • WILL GIVE BRAINLIEST! I'm doing a project at school. Does anyone have any good explanations for Digital Art? I need it to be at
    13·2 answers
  • Research information technology affects on job market, career pathways, occupational outlooks in business and finance and synthe
    7·1 answer
  • Give 5 uses of software and hardware.
    15·1 answer
  • Which technology can be used to protect the privacy rights of individuals and simultaneously allow organizations to analyze data
    13·1 answer
  • Bran is writing a book on operation system errors. Help him complete the sentences.
    7·1 answer
  • Which of the following countries have mixed-market economy
    5·1 answer
  • A good sentence about art
    9·1 answer
  • What is this....... Iam booking train to patna. ​
    13·2 answers
  • The most widely used computer device​
    6·2 answers
  • Debra tracks her business finances in a spreadsheet. She wants to figure out how much she could increase profits if she raises p
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!