标签:
import java.util.Scanner; public class SortOfThree { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("请依次输入三个整数:a,b,c(以空格隔开)"); int a = scanner.nextInt(); int b = scanner.nextInt(); int c = scanner.nextInt(); scanner.close(); System.out.println("您输入的是:"); System.out.println("a=" + a + ", b=" + b + ", c=" + c); int temp = 0; if (a > b) { temp = a; a = b; b = temp; } if (a > c) { temp = a; a = c; c = temp; } if (b > c) { temp = b; b = c; c = temp; } System.out.println("升序排列后,结果为:"); System.out.println("a=" + a + ", b=" + b + ", c=" + c); } }
标签:
原文地址:http://www.cnblogs.com/luckyBrown/p/5840497.html