๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
  • What would life be If we had no courage to attemp anything?
Language/Java

[์ƒํ™œ์ฝ”๋”ฉ] Java-์ˆซ์ž์™€ ์—ฐ์‚ฐ

by DevIseo 2022. 4. 14.

์ˆซ์ž์™€ ์—ฐ์‚ฐ

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์˜ ๊ฒฝ์šฐ ์†Œ์ˆซ์  ์ดํ•˜๋ฅผ ๋ฒ„๋ฆฌ๊ณ  ์˜ฌ๋ฆผํ•ด์ค€๋‹ค.

๋Œ“๊ธ€