Could someone help me out with this MOOCI Java Programming I exercise?

import java.util.Scanner;

public class FromWhereToWhere {

public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);

System.out.println("Where to? ");

int toNumber = Integer.valueOf(scanner.nextLine());

System.out.println("Where from? ");

int fromNumber = Integer.valueOf(scanner.nextLine());

if (toNumber > fromNumber) {

for (int i = fromNumber; i <= toNumber; i++){

System.out.println(i);

}

}

}

}

this is my code for the assignment

but it keeps failing the following test the WhereFromHiddenTest stating "With the input 1, 1 the output should be 1 number, now it was 0

Posted Mar 30, 2026, 6:03 AM UTC

11
Loading comments…