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, 22.06.2019 18:30
Which of the following is an example of intellectual properly! oa. new version of a novelb. journal of ideasc. pages of a bookood. lines of a poem
Answers: 2
question
Computers and Technology, 22.06.2019 19:00
How is the number 110 written when expanded out to place values in the base 2 (binary) number system? options: 2 x 4 + 3 x 2 + 4 x 1 1 x 2 + 1 x 2 + 0 x 2 1 x 100 + 1 x 10 + 0 x 1 1 x 4 + 1 x 2 + 0 x 1
Answers: 1
question
Computers and Technology, 23.06.2019 07:00
To produce a starlight effect in her photograph, lina should choose the filter for her camera.
Answers: 1
question
Computers and Technology, 23.06.2019 23:00
Computer programming is one type of what career
Answers: 1
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
Business, 11.05.2021 07:40
question
Mathematics, 11.05.2021 07:40
question
Mathematics, 11.05.2021 07:40
question
Mathematics, 11.05.2021 07:40
question
English, 11.05.2021 07:40
question
Mathematics, 11.05.2021 07:40
question
Mathematics, 11.05.2021 07:50
Questions on the website: 13722361