greatest among three numbers
作者:互联网
public class Solution { public static void main(String[] args) { Scanner ip = new Scanner(System.in); System.out.print("Enter A: "); int a = ip.nextInt(); System.out.print("Enter B: "); int b = ip.nextInt(); System.out.print("Enter C: "); int c = ip.nextInt(); int great = a >= b ? (a >= c ? a : c) : (b >= c ? b : c); System.out.println("Greatest among three numbers is: " + great); ip.close(); } } OUTPUT: Enter A: 1 Enter B: 2 Enter C: 3 Greatest among three numbers is: 3
标签:among,int,ip,System,numbers,Enter,out,greatest 来源: https://www.cnblogs.com/sea-stream/p/12013070.html