example(计算数字)()

package Xy;

public class Mhddxll3 {

public static void main(String[] args) { System.out.println(“计算绝对值的结果为:”+Math.abs(-20)); System.out.println(“计算大于参加的最小整数:”+Math.ceil(5.4)); System.out.println(“计算小于参加的最小整数:”+Math.floor(-9.7)); System.out.println(“计算两个数的较大值:”+Math.max(8, 55)); System.out.println(“计算两个数的最小值:”+Math.min(-3.2, 7.9)); System.out.println(“计算开平方的结果为:”+Math.sqrt(9)); System.out.println(“计算指数的结果为:”+Math.pow(4, 2)); System.out.println(“生产大于0.0,小于1.0的随机数”+Math.random()); double num=getNum(2,32); System.out.println(“任意2-32之间的随机数为:”+num); } public static double getNum(double num1,double num2) { int num=(int)num1+(int)(Math.random()*(num2-num1)); return num; }}

————————

package Xy;

public class Mhddxll3 {

public static void main(String[] args) { System.out.println(“计算绝对值的结果为:”+Math.abs(-20)); System.out.println(“计算大于参加的最小整数:”+Math.ceil(5.4)); System.out.println(“计算小于参加的最小整数:”+Math.floor(-9.7)); System.out.println(“计算两个数的较大值:”+Math.max(8, 55)); System.out.println(“计算两个数的最小值:”+Math.min(-3.2, 7.9)); System.out.println(“计算开平方的结果为:”+Math.sqrt(9)); System.out.println(“计算指数的结果为:”+Math.pow(4, 2)); System.out.println(“生产大于0.0,小于1.0的随机数”+Math.random()); double num=getNum(2,32); System.out.println(“任意2-32之间的随机数为:”+num); } public static double getNum(double num1,double num2) { int num=(int)num1+(int)(Math.random()*(num2-num1)); return num; }}