Written by
java-style
on
on
OCT 16th, 2021 Today's coding
OCT 16th, 2021 Today's coding
>java 숫자와 연산
public class Number { public static void main(String[] args) { // Operator System.out.printin(6 + 2); // 8 System.out.printin(6 - 2); // 4 System.out.printin(6 * 2); // 12 System.out.printin(6 / 2); // 3 System.out.printin(Math.PI); // 3.1415926 System.out.printin(Math.floor(Math.PI)); System.out.printin(Math.ceil(Math.PI)); } }
사칙연산
+ 덧셈
- 뺄셈
* 곱셈
/ 나눗셈
Math.e는 자연상수를 출력해준다.
Math.PI는 파이값을 출력해준다.
Math.abs()는 값을 절댓값으로 출력해준다.
Math.sqrt()는 값에 루트를 씌워서 출력해준다.
Math.ceil(실수)는 첫 번째 소수점을 내림해서 출력해준다.
Math.floor(실수)는 첫 번째 소수점을 올림해서 출력해준다.
from http://william-log.tistory.com/8 by ccl(A) rewrite - 2021-10-16 22:26:59