import java.util.*; public class lianxi72_3 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner s=new Scanner(System.in); System.out.println("请输入a的值:"); int a=s.nextInt(); System.out.println("请输入b的值:"); int b=s.nextInt(); System.out.println("请输入c的值:"); int c=s.nextInt(); int x=0; if(a>b) { x=a; a=b; b=x; } if(a>c) { x=a; a=c; c=x; } if(b>c) { x=b; b=c; c=x; } System.out.println(a+","+b+","+c); } }
Java-第三章-从键盘输入3个整数,然后将输入的整数按照从小到大的顺序放在abc,并输出3个变量的值,布布扣,bubuko.com