+91-85006-22255
Write a program to create an array containing the numbers in the given range.
10, 20
{10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}
-6, 4
{-6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4}
2, 9
{2, 3, 4, 5, 6, 7, 8, 9}
class CreateNumbersInRangeArray { public static void main(String s[]) { int result[] = createNumbersInRangeArray(10, 20); for(int i = 0; i < result.length; i++) { System.out.print(result[i] + " "); } } public static int[] createNumbersInRangeArray(int start, int end) {
} }
Topic: Learn Arrays And Loops
Read this topic Take test on this topic
Open In App