输入三个数字从小到大的排列输出

211 阅读1分钟

import java.util.Scanner; public class shuru { public static void main(String []ages){ Scanner a=new Scanner(System.in); System.out.println("请输入三个数"); int b=a.nextInt(); int d=a.nextInt(); int c=a.nextInt(); if (b<d){ int t=b; b=d; d=t; } if(b<c) { int t = b; b = c; c = t; } if(d<c){ int t=d; d=c; c=t; } System.out.println("从小到大的顺序输出"); System.out.println(c+"\t"+d+"\t"+"\t"+b); } }