8 Replies Latest reply: Oct 22, 2006 10:09 PM by 807607 RSS

    How to calculate Lowest number using While or if

    807607
      Hi all,
      The program basically has to have 6 numbers inputted. Theoretically these are test scores. It then has to calculate the lowest number.
      Im stuck trying to figure out how to arrange the if statement. Anyone know how to do this.

      You would need to store the number if it is lower than the first. THis is my code so far
       import java.util.Scanner; 
       
      public class TestScore 
      {
          public static void main(String[] args) 
          {
          
         Scanner keyboard = new Scanner(System.in);
         
               System.out.println("Please input your six test scores ");
               
               double numOne = keyboard.nextDouble();
               double numTwo = keyboard.nextDouble();
               double numThree = keyboard.nextDouble();
               double numFour = keyboard.nextDouble();
               double numFive = keyboard.nextDouble();
               double numSix = keyboard.nextDouble();
               
               
               System.out.print("Your scores are: " + numOne +" "+ numTwo +" "+ numThree + " ");
               System.out.println(numFour +" "+ numFive +" " + numSix);
               
               int n = numOne;
               int count = 1;
               
                    while (count <= 6)
                    {
                    
                         if()
                         {
                    
                          }
                          
                    count++;
                    }
                 
         
        
       
          }
      }