Competitive Programming Solutions

GitHub
back to dashboard

B. Even Numbers

Codeforces - Sheet #2 (Loops) · limit: 1s · memory: 256MB · view on codeforces

input

10

output

2
4
6
8
10
Main.java
static void solve() {
        
        // Write your solution here
        int n = in.nextInt();
        if(n < 2){
            out.println("-1");
            return;
        }
        int i = 2;
        while(i <= n){
            out.println(i);
            i+=2;
        }
    }