// please help me, I am trying to return the lowest value from the array. having trouble trying to capture the return value by placing it into the variable .. int myLowest = getLowest(yourNumbers); and then printing out myLowest
import java.util.*;
public class numArrays
{
public static void main(String[] args){
int numbers;
int[]yourNumbers;
Scanner keyboard = new Scanner(System.in);
System.out.print("How many numbers do you want to enter?");
numbers = keyboard.nextInt();
yourNumbers = new int[numbers];
for (int i = 0; i < yourNumbers.length; i++){
System.out.print("Enter Numbers" + (i + 1) + ":");
yourNumbers[i] = keyboard.nextInt();
}
System.out.print("Here are your numbers:");
for(int i = 0; i < yourNumbers.length; i++)
System.out.print(yourNumbers[i] + " ");
getLowest(yourNumbers);
}
public static int getLowest(int[] yourNumbers)
{
int lowest = yourNumbers[0];
{
for(int i = 1; i < yourNumbers.length; i++)
if (yourNumbers[i] < lowest)
lowest = yourNumbers[i];
}
return(lowest);
int myLowest = getLowest(yourNumbers);
System.out.print(myLowest);
}
}