Fill in the below method so that, when executed, it
reads an integer
n from the user and displays the positive even integers that are less
than or equal to n, in ascending order.
Following is a sample transcript illustrating how
an execution of the method should appear.
Number? 8
2
4
6
8
public static void run() {
}
The odd-integer answer is identical, except that it begins i at 1.public static void run() { IO.print("Number? "); int num = IO.readInt(); for(int i = 2; i <= num; i += 2) { IO.println(i); } }
for(int i = 1; i <= num; i += 2) {