+91-85006-22255
Write a program to create an array containing the odd numbers till a given number.
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) {
} }
Topic: Learn Arrays And Loops
Read this topic Take test on this topic
Open In App