title: Finding the minimum of 3 variables using an if statement
body: <p>I'm learning how to use BlueJ and I am struggling in writing the code for it to output the minimum number that the user has inputted. Any help would be appreciated!</p>
  
  <pre><code>import java.util.Scanner;
  public class FindMin
  {
      public static void main(String[] args)
      {
          System.out.print("Program to compare three numbers");
          System.out.println("and output minimum value entered");
  
          Scanner input = new Scanner(System.in);
  
          System.out.print("Enter 1st number: ");
          int number1;
          number1 = input.nextInt();
  
          System.out.print("Enter 2nd number: ");
          int number2;
          number2 = input.nextInt();
  
          System.out.print("Enter 3rd number: ");
          int number3;
          number3 = input.nextInt();
  
          int minimum;
          if (number2 &gt; number1 | number3 &gt; number1){
              minimum = number1;
          }
          else if (number1 &gt; number2 | number3 &gt; number2){
              minimum = number2;
          }
          else if (number1 &gt; number3 | number2 &gt; number3){
              minimum = number3;
          }
  
          System.out.print("The minimum of the numbers entered is ");
          System.out.println(minimum); 
          System.out.println(); 
      }
  }
  </code></pre>