A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

/*
                public static int min(int a,int b) 求两个数的最小值
                public static int max(int a,int b) 求两个数的最大值
                public static long round(double a) 四舍五入
                public static double ceil(double a) 向上取整
                public static double floor(double a) 向下取整
*/
public class MyMath {
        public static void main(String[] args) {
                int a = 50;
                int b = 60;
                int min = Math.min(a,b);
                int max = Math.max(a,b);
                long i = Math.round(45.6);
                double x = Math.ceil(90.1);
                double y = Math.floor(90.1);
               
                System.out.println(min);                        //50
                System.out.println(max);                        //60
                System.out.println(i);                                //46
                System.out.println(x);                                //91.0
                System.out.println(y);                                //90.0
        }
}

0 个回复

您需要登录后才可以回帖 登录 | 加入黑马