三个整数排序

来源:互联网 发布:微信群一键加好友软件 编辑:程序博客网 时间:2024/06/05 04:39
import java.util.Scanner;public class ThreeSort {    public static void main(String[] args) {        System.out.println("请输入三个数:");        Scanner in = new Scanner(System.in);        int a = in.nextInt();        int b = in.nextInt();        int c = in.nextInt();        if(a>b){            int temp = a;            a = b;            b = temp;        }        if(a>c){            int temp = a;            a = c;            c = temp;        }        if(b>c){            int temp = b;            b = c;            c = temp;        }        System.out.println(a+","+b+","+c);    }}

原创粉丝点击