Q:

A loop that asks for a certain amount of numbers and outputs the how many of them are even

I need to write a program that asks for 20 numbers and outputs the amount of even numbers. I figured out the loop part (for-loop) but i don't have any idea how to collect the data if that makes any sense.
Here is the loop:
for (int num = 0; num < 20; num++) {
    System.out.println("Anna luku");
    num = input.nextInt();
}

A:

If you want to give the numbers when you run the program you can use this:
public static void main(String[] args) {
    int counter=0;
    Scanner sc = new Scanner(System.in); 
    System.out.println("Write 20 numbers:");
    for(int i=0; i<20; i++) {
        System.out.print("Number " + i + ":");
        int temp =sc.nextInt(); //this waits for you to write an int
        if(temp%2==0)
            counter++;
    }
    sc.close();
    System.out.println("Even numbers:" + counter);
}

i've tested it ant it works, keep in mind that you need to press enter after you write each number

