import java.util.Scanner; public class Ex2_6 { public static void main(String[] args) { int a,b,c; System.out.println("请输入三个整数"); Scanner input = new Scanner(System.in); a = input.nextInt(); b = input.nextInt(); c = input.nextInt(); int temp; 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("从小到大的顺序是:"+ a + ","+ b +","+ c); } }
从键盘输入三个整数,按从小到大顺序输出
最新推荐文章于 2024-04-16 16:52:54 发布