Menu
Question Index
...

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

Input (Integer) Output (Integer Array)
7 {1, 3, 5, 7}
10 {1, 3, 5, 7, 9}



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

    }


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

}

Doubts

Problems

Topic: Learn Arrays And Loops

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App