1、 import java.util.Scanner; public class Covert1 { public static void main(String[] args){ int a,b,c,t; Scanner sc=new Scanner(System.in); //输入 System.out.println("please input the first integer"); a=sc.nextInt(); //获取输入的数 System.out.println("please input the second integer"); b=sc.nextInt(); System.out.println("please input the third integer"); c=sc.nextInt(); ----------------------------------------------------------------- 第一种方法: if(ab){ t=a;a=b;b=t; } if(b>c){ t=b;b=c;c=t; } if(a>c){ t=a;a=c;c=t; } System.out.println(a+" "+b+" "+c); --------------------------------------------------------------------------- } }
三个数排序java_三个数的排序java写法
最新推荐文章于 2023-09-23 15:17:20 发布