์ซ์์ ์ฐ์ฐ
public class Number {
public static void main(String[] args) {
//Operator
System.out.println(6 + 2); //8
System.out.println(6 - 2); //4
System.out.println(6 * 2); //12
System.out.println(6 / 2); // 3
System.out.println(Math.PI);//3.141592653589793
System.out.println(Math.floor(Math.PI));//3.0
System.out.println(Math.ceil(Math.PI));//4.0
}
}
python์ฒ๋ผ ์ฐ์ฐ์๋ฅผ ์ด์ฉํด ๊ณ์ฐ์ด ๊ฐ๋ฅ.
python๊ณผ ๊ฐ์ด Math ๋ชจ๋์ ๋ถ๋ฌ์์ ์ฌ์ฉํ ์ ์์.
Math.floor์ ๊ฒฝ์ฐ ์์ซ์ ์ดํ๋ฅผ ๋ฒ๋ฆฌ๊ณ , Math.ceil์ ๊ฒฝ์ฐ ์์ซ์ ์ดํ๋ฅผ ๋ฒ๋ฆฌ๊ณ ์ฌ๋ฆผํด์ค๋ค.
'Language > Java' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[์ํ์ฝ๋ฉ] Java - ์ ์ด๋ฌธ (boolean) (0) | 2022.04.25 |
---|---|
[์ํ์ฝ๋ฉ] Java - ๋ณ์ (0) | 2022.04.14 |
[์ํ์ฝ๋ฉ] Java - ๋ฌธ์์ด (0) | 2022.04.14 |
[์ํ์ฝ๋ฉ] Java - ๋ฐ์ดํฐ์ ์ฐ์ฐ, ๋ฐ์ดํฐ ํ์ (0) | 2022.04.13 |
[์ํ์ฝ๋ฉ] Java - ์คํ (0) | 2022.04.13 |
๋๊ธ