89.0k views
0 votes
Write three statements to print the first three elements of array runTimes. Follow each statement with a newline. Ex: If runTime = {800, 775, 790, 805, 808}, print:

800
775
790

1 Answer

4 votes

Answer:

Answered below

Step-by-step explanation:

//Program is written in Java.

public void first three elements(int[] nums){

int I;

//Check if array has up to three elements

if(nums.length > 3){

for(I = 0; I < nums.length; I++){

while (I < 3){

System.out.println(nums [I]);

}

}

else{

System.out.print("Array does not contain up to three elements");

}

}

}

User Brown A
by
4.5k points