Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Replace with your answer. Your code should sum all the numbers in the range [lowerBound, upperBound]. For example, if lowerBound=3 and upperBound=10. Your code should
Replace with your answer. Your code should sum all the numbers in the range [lowerBound, upperBound]. For example, if lowerBound=3 and upperBound=10. Your code should compute the following sum 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10.
public static void main(String[]args{
Scanner scanner = new Scanner(System.in);
int lowerBound = scanner.nextInt();
int upperBound = scanner.nextInt();
int sum=0;
Sustem.out.println("sum =" + sum);
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started