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
Ymorist [56]
3 years ago
9

In this exercise, use the following variables : i,lo, hi, and result. Assume that lo and hi each are associated with an int and

that result refers to 0.
Write a while loop that adds the integers from lo up through hi (inclusive), and associates the sum with result.

Your code should not change the values associated with lo and hi. Also, just use these variables : i,lo, hi, and result.
Computers and Technology
1 answer:
Assoli18 [71]3 years ago
7 0

Answer:

result = 0

i = lo

while i <= hi:

       result = result + i

       i += 1

Explanation:

Initialize the <em>result</em> as 0 to hold the summation value.

Since we are asked not to change the value of <em>lo</em> and <em>hi</em>, our loop control variable is <em>i</em> and initially it starts from <em>lo.</em>

Since we are asked to add the number from <em>lo</em> to <em>hi, </em>while loop condition checks it.

While the condition satisfies (during each iteration), the value of <em>i</em> is added to the result and the value of <em>i</em> is incremented by one.

You might be interested in
Your brother is starting 9th grade next year and is thinking about going to college. What step would you recommend he take?
postnew [5]
I would say D. Usually students aren't expected to fill out the FAFSA till junior or senior year, this is because it is based on household income which may change every year. Also, guidance counselor's can help students on the right track to go to classes. Clubs and/or sports teams look really good on college applications and are usually preferred by colleges. 
4 0
2 years ago
What are some facts about webmasters?
FromTheMoon [43]
Webmasters monitor  the server to be sure  it is  running,Some webmasters decide what kind of  computer will hold a websites information ,Some webmasters abuse other sites by exploiting their comment fields.
4 0
3 years ago
Constructors have the same name as the ____.1. data members2. member methods3. class4. package
Svetradugi [14.3K]

Answer:

(3) option is the correct answer.

Explanation:

Constructors need to initialize the object in the memory. "To declare the Constructor for any class the user needs to specify the constructor name which is already the class name". This is an object-oriented language guideline.

It is because the object is created by the name of the class and Constructor is used to allocate the memory for the object. hence Constructor is created by the name of the class.

For example--

                       class test //class name test

                      {

                               test() //created a constructor with class name "test"

                               {

                               }

                      }

In the above example class name and constructor name are same if it not then it will gives a error.

Another option is not valid for the answer to the above problem because-

  • Option 1 is wrong because, for any class, the data member is a type of variable, which is used to store the data and is accessed with the help of an object.
  • Option 2 is wrong because, for any class, member function is a type of user function used to accessed the variable and expressions.
  • Option 4 is wrong because, package is a set used to hold classes and interfaces.

8 0
3 years ago
In the Happy Valley School System, children are classified by age as follows: less than 2, ineligible 2, toddler 3-5, early chil
sasho [114]

// C++ switch

// It can also be used for JAVA, C#

switch(age){

// here age will be sent by the function in which it is used

// case to check the age<2

case(age<2 && age>0):

// printing the line

cout<<"ineligible";

// case to check the age ==2

case(age==2):

// printing the line

cout<<"toddler";

// case to check 3-5

case(age>=3 && age<=5):

cout<<"early childhood";

// case to check 6-7

case(age==6 || age==7):

cout<<"young reader";

//case to check 8-10

case(age>=8 && age<=10):

cout<<"elementary";

// case to check 13

case(age==13):

cout<<"impossible";

//case tocheck 14-16

case(age>=14 && age<=16):

cout<<"high school";

// case to check 17 or 18

case(age==17 || age==18):

cout<<"scholar";

//case to check >18

case(age>18);

cout<<"ineligible";

// default case

default:

cout<<"Invalid age";

}

Read more on Brainly.com - brainly.com/question/12981906#readmore

5 0
3 years ago
Is there an answer to these picture?
Tomtit [17]

Answer:

yes there is an answer to this question

6 0
3 years ago
Other questions:
  • what is the software that controls the storage, retrieval and manipulation of database stored in a database
    14·1 answer
  • Which of the following is a job description for a person with a degree in information technology
    15·1 answer
  • Which file system is designed to verify and autocorrect data faults on the volume without having to bring the volume down for ma
    11·1 answer
  • What is the first step to apply the line and page breaks options to groups of paragraphs in a Word document?
    10·2 answers
  • Nathan has a 30-second clip of music that he wants to play over and over again when he runs a program. What does Nathan need to
    5·2 answers
  • The create_python_script function creates a new python script in the current working directory, adds the line of comments to it
    6·1 answer
  • Gus has decided to organize his inbox on June 26 by using folders and deleting irrelevant messages. He creates a folder called "
    12·2 answers
  • How many passes will it take to find 30 using a binary search?
    6·1 answer
  • Which of the following rules need to be followed when using variables?<br> Choose all that apply.
    9·2 answers
  • Give the value of the zero flag, the carry flag, the signflag, and the overflow flag after each of the following instructions if
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!