/home/caleb/NetBeansProjects/ADSV Java/lab9_CalebFontenot/src/main/java/com/calebfontenot/lab9_calebfontenot/MinimumOf4ConditionalOperator.java |
package com.calebfontenot.lab9_calebfontenot;
import java.util.Scanner;
@author
public class MinimumOf4ConditionalOperator {
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
while (true) {
System.out.println("Please enter 4 numbers to find the minimum of the 4: ");
int _1 = scan.nextInt();
int _2 = scan.nextInt();
int _3 = scan.nextInt();
int _4 = scan.nextInt();
System.out.println("minimum= "
+ ((_1 < _4)
? (_1 < _3)
? (_1 < _2)
? _1
: _2
: (_3 < _2)
? _3
: _2
: (_4 < _3)
? (_4 < _2)
? _4
: _2
: (_3 < _2)
? _3
: _2)
);
scan.next();
}
}
}