subject

Assume the int variables i ,lo , hi , and result have been declared and that lo and hi have been initialized. Assume further that result has been initialized to the value 0.
Write a for loop that adds the integers from lo up through hi (inclusive), and stores the result in result.
Do not declare any additional variables --
use only i, lo, hi.

import java. util. Scanner;
public class forloop_add{
public static void main(String args[]) {
int i, lo=1,hi=3,result=0;
Scanner scanner =new Scanner(System. in);
System. out. println("Enter the lower limit:");
lo=scanner. nextInt();
System. out. println("Enter the upper limit:");
hi=scanner. nextInt();
///{
//write your code here
//start
//end
///}
System. out. println("Result:"+result);
}
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 23:00
In a file-oriented information system, a work file stores relatively permanent data about an entity is created and saved for backup and recovery purposes stores records that contain day-to-day business and operational data is a temporary file created by an information system for a single task
Answers: 1
question
Computers and Technology, 22.06.2019 17:00
Aisha has finished working on a word processing document that contains 15 pages. she has added some special elements in the first three pages, page 9 and 10, and page 15 from the document. she wants to print only these pages to see how they look. which option is the correct way to represent (in the print dialog box) the pages that aisha wants to print
Answers: 3
question
Computers and Technology, 22.06.2019 18:30
Kto rozmawia z clamentain przez krótkofalówke w the walking dead która śledzi lee w 4 epizodzie
Answers: 1
question
Computers and Technology, 22.06.2019 21:40
Develop a function to create a document in the mongodb database “city” in the collection “inspections.” be sure it can handle error conditions gracefully. a. input -> argument to function will be set of key/value pairs in the data type acceptable to the mongodb driver insert api call b. return -> true if successful insert else false (require a screenshot)
Answers: 2
You know the right answer?
Assume the int variables i ,lo , hi , and result have been declared and that lo and hi have been ini...
Questions
question
History, 11.05.2021 01:00
question
Mathematics, 11.05.2021 01:00
question
Arts, 11.05.2021 01:00
Questions on the website: 13722361