java question: The following is a code that prints an array from 0 to 10000. Can
ID: 3905941 • Letter: J
Question
java question:
The following is a code that prints an array from 0 to 10000. Can someone please modify the following code to do the following:
The array still contains all integers between 0 and 10,000. Print the first 25 numbers, 5 numbers per line, seperated each by a comma.TH
THE FOLLOWING CODE TO MODIFY:
public class Integers
{
public static int[ ] integers(int numbers)
{
//creates an array containing desired integers
int[] result = new int[numbers];
for(int i = 0; i < numbers; i++){
result[i] = i;
}
return result;
}
public static void main(String[] args)
{
int[] z = integers(10001);
for(int i = 0; i < z.length; i++)
System.out.println(z[i]);
}
}
Thank you!!!
Explanation / Answer
public class Integers { public static int[ ] integers(int numbers) { //creates an array containing desired integers int[] result = new int[numbers]; for(int i = 0; iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.