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, 23.06.2019 09:30
You have been supporting csm tech publishing's windows server 2016 server network for over a year. the office has two windows server 2016 servers running active directory and a number of other roles. management has informed you that a small sales office is opening in the same building three floors up. the sales manager wants to install a sales application on a server located in the sales office. this server will have limited physical security because there's no special room dedicated for it, which means it will be accessible to non-it personnel and visitors. you're considering installing windows server 2016 server core on the new server because accessing its console regularly probably won't be necessary, and this server will be managed from one of the other csm tech publishing servers. what are the benefits and drawbacks of using server core for this branch office? what are some things you should do to set up this server management environment?
Answers: 1
question
Computers and Technology, 23.06.2019 13:30
Best laptops for college [$100-$500 range]?
Answers: 2
question
Computers and Technology, 24.06.2019 02:30
Assume a class window with accessor method getwidth that accepts no parameters and returns an integer. assume further an array of 3 window elements named winarr, has been declared and initialized. write a sequence of statements that prints out the width of the widest window in the array.
Answers: 2
question
Computers and Technology, 24.06.2019 02:50
Be sure to answer all parts. synthesize the following compound from benzene. a. b. c. d. e. f. reaction [1] conditions: a b c d e f reaction [1] product: draw structure reaction [2] conditions: a b c d e f reaction [2] product: draw structure reaction [3] conditions: a b c d e f reaction [3] product:
Answers: 3
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
English, 19.10.2021 21:10
question
Mathematics, 19.10.2021 21:10
question
Engineering, 19.10.2021 21:10
question
Mathematics, 19.10.2021 21:10
question
Mathematics, 19.10.2021 21:20
Questions on the website: 13722359