class
apples{
public
static
void
main(String args[]){
System.out.println(Math.abs(-26.7));
System.out.println(Math.ceil(7.4));
System.out.println(Math.floor(7.8));
System.out.println(Math.max(8.6,5.2));
System.out.println(Math.min(8.6,5.2));
System.out.println(Math.pow(5,3));
System.out.println(Math.sqrt(9));
}
}
(Math.abs(-26.7));
→ABS意味著絶對值
(Math.ceil(7.4));
→值將四捨五入=
8
(Math.floor(7.8));
→值將向下舍入=
7
(Math.max(8.6,5.2));
→比較,數量是最大
(Math.min(8.6,5.2));
→比較數量最低
(Math.pow(5,3));
→
5*5*5 = 125
(Math.sqrt(9));
→
9
=3的平方根
該Program將運行這樣的:
26.7
8.0
7.0
8.6
5.2
125.0
3.0
沒有留言:
張貼留言