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 17:00
Which process would best represent the opposite of exhausting air from a system?
Answers: 2
question
Computers and Technology, 21.06.2019 18:00
Ihave buncha points. does anyone want any?
Answers: 1
question
Computers and Technology, 22.06.2019 09:50
What is a rush associated with alcohol?
Answers: 1
question
Computers and Technology, 22.06.2019 19:20
How might the success of your campaign be affected if you haven’t carefully completed all field data or if you accidentally insert the wrong merge field in the document?
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
Mathematics, 04.12.2019 01:31
question
Mathematics, 04.12.2019 01:31