mathdemo1.java
来自「JAVA的例子程序」· Java 代码 · 共 23 行
JAVA
23 行
public class MathDemo1{
public static void main(String arg[]){
System.out.println("Pi="+Math.PI);
System.out.println("E="+Math.E);
System.out.println("abs(-6.5)="+Math.abs(-6.5));
System.out.println("ceil(-6.3)="+Math.ceil(-6.3));
System.out.println("floor(-6.3)="+Math.floor(-6.3));
System.out.println("round(-6.3)="+Math.round(-6.3));
System.out.println("round(+6.3)="+Math.round(6.3));
System.out.println("round(-6.5)="+Math.round(-6.5));
System.out.println("round(+6.5)="+Math.round(6.5));
System.out.println("round(-6.6)="+Math.round(-6.6));
System.out.println("round(+6.6)="+Math.round(6.6));
System.out.println("max(-6.3,-6)="+Math.max(-6.3,-6));
System.out.println("min(-6.3,-6)="+Math.min(-6.3,-6));
System.out.println("random()="+Math.random());
System.out.println("sqrt(4)="+Math.sqrt(4));
System.out.println("sin(30 degree)="+Math.sin(Math.toRadians(30)));
System.out.println("cos(60 degree)="+Math.cos(Math.toRadians(60)));
System.out.println("tan(45 degree)="+Math.tan(Math.toRadians(45)));
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?