Question: 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);
}
2. Replace
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
