import java.util.Scanner; public class Test { public static void main(String[] args) { System.out.println("Please enter values:"); Scanner in = new Scanner(System.in); double input; double largest = Double.NEGATIVE_INFINITY; double smallest = Double.POSITIVE_INFINITY; while( ( (input = in.nextDouble()) != 0 && ( ( (input > largest) && (largest=input)!=input ) || ( ( (input < smallest) && (smallest=input)==input ) || true ) ) ) || ( largest == Double.NEGATIVE_INFINITY && ( (largest=0)==0 && (smallest=0)!=0 ) ) ); in.close(); System.out.println("The smallest value was " + smallest); System.out.println("The largest value was " + largest); } }