public class MathDemo
{
public static void main(String args[])
{
System.out.println("abs(-5) = "+Math.abs(-5));
System.out.println("max(6.75,3.14) = "+Math.max(6.75,3.14));
System.out.println("min(100,200) = "+Math.min(100,200));
System.out.println("round(3.5)= "+Math.round(3.5));
System.out.println("round(-6.5) = "+Math.round(-6.5));
System.out.println("sqrt(2) = "+Math.sqrt(2));
System.out.println("pow(2,5) = "+Math.pow(2,5));
System.out.println("E = "+Math.E);
System.out.println("exp(2) = "+Math.exp(2));
System.out.println("log(2) = "+Math.log(2));
System.out.println("ceil(6.75) = "+(int)Math.ceil(6.75));
System.out.println("floor(6.75) = "+(int)Math.floor(6.75));
System.out.println("Pi = "+Math.PI);
System.out.println("sin(Pi/4) = "+Math.sin(Math.PI/4));
System.out.println("cos(1)= "+Math.cos(1));
}
}
MathDemo
最新推荐文章于 2017-10-21 13:54:31 发布