I need to also know what happens if two or more values are equal and if exactly two values are equal, does it matter whether the equal values are lower or higher than the third??
import java.util.Scann er;
public class MinOfThree
{
//-----------------------------------------------------------------
// Reads three integers from the user and determines the smallest
// value.
//-----------------------------------------------------------------
public static void main (String[] args)
{
int num1, num2, num3, min = 0;
Scanner scan = new Scanner (System.in);
System.out.prin tln ("Enter three integers: ");
num1 = scan.nextInt();
num2 = scan.nextInt();
num3 = scan.nextInt();
if (num1 < num2)
if (num1 < num3)
min = num1;
else
min = num3;
else
if (num2 < num3)
min = num2;
else
min = num3;
System.out.prin tln ("Minimum value: " + min);
}
}
import java.util.Scann er;
public class MinOfThree
{
//-----------------------------------------------------------------
// Reads three integers from the user and determines the smallest
// value.
//-----------------------------------------------------------------
public static void main (String[] args)
{
int num1, num2, num3, min = 0;
Scanner scan = new Scanner (System.in);
System.out.prin tln ("Enter three integers: ");
num1 = scan.nextInt();
num2 = scan.nextInt();
num3 = scan.nextInt();
if (num1 < num2)
if (num1 < num3)
min = num1;
else
min = num3;
else
if (num2 < num3)
min = num2;
else
min = num3;
System.out.prin tln ("Minimum value: " + min);
}
}
Comment