In: Computer Science
Explanation:I have written the program EvenNumbers that prompts the user for lower and upper bound and displays all the even integers and have also shown the output of the program, please find the images attached with the answer.Please upvote if you liked my answer and comment if you need any modification or explanation.
//code
import java.util.Scanner;
public class EvenNumbers {
public static void main(String[] args) {
Scanner input = new
Scanner(System.in);
System.out.print("Enter the lower
bound for even numbers:");
int lowerBound =
input.nextInt();
System.out.print("Enter the upper
bound for even numbers:");
int upperBound =
input.nextInt();
System.out.println("Even numbers
within the range inputted are:");
for (int i = lowerBound; i <=
upperBound; i++) {
if (i % 2 ==
0)
System.out.print(i + " ");
}
input.close();
}
}
Output: