Create an array containing the even numbers till a given input number - Java Quiz Question


Write a program to create an array containing the even numbers till a given number.

Input (Integer) Output (Integer Array)
5 {2, 4}
10 {2, 4, 6, 8, 10}



class CreateEvenNumbersArray
{
    public static void main(String s[])
    {
        int result[] = createEvenNumbersArray(7);
        
        for(int i = 0; i < result.length; i++)
        {
            System.out.println(result[i]);
        }

    }


    public static int[] createEvenNumbersArray(int input)
    {
    }

}