解题思路:





注意事项:





参考代码:

import java.util.Scanner;


public class Main {

        public static void Sort(int a,int b,int c){

                int temp;

                if(a>b){

                    temp = b;

                    b = a;

                    a = temp;

                }

             if(a>c){

                     temp = a;

                     a = c;

                     c = temp;

             }

             if(b>c){

                     temp = b;

                     b = c;

                     c = temp;

             }

        System.out.print(a+" "+b+" "+c+" ");

        }

        public static void main(String[] arg){

                 Scanner sc = new Scanner(System.in);

                 int a = sc.nextInt();

                 int b = sc.nextInt();

                 int c = sc.nextInt();

                 Sort(a, b, c);

        }

}


 

0.0分

0 人评分

C语言网提供「C语言、C++、算法竞赛」在线课程,全部由资深研发工程师或ACM金牌大佬亲授课,更科学、全面的课程体系,以在线视频+在线评测的学习模式学习,学练同步,拒绝理论派,真正学会编程!还有奖学金等增值福利等你!

  评论区