I can loop simply but it is hard for me to do even and odd numbers only. I want it like these for example:

Enter your number: *20*

2 4 6 8 10 12 14 16 18 20

Do you want to do it again? Yes/No?

My code:

```
public static void main(String[] args) {
    Scanner input=new Scanner(System.in);
    String c = null;
    do {
        int i;
        System.out.println("Enter a Number:");
        int n = input.nextInt();

        for(i=1; i<n; i++) {
            System.out.println(i);
            if(n%2==0) {
                System.out.println(i + " " );

            }
            System.out.println("Try Again? Y/N");
            c = input.next();   

        }
    }while(c.equalsIgnoreCase("y"));
}

```