영상
개념
<script>
/*
[개념] 몫과 나머지
[1] 몫 구하는 방법
parseInt(정수 / 정수)
[2] 나머지 구하는 방법
%
*/
console.log(10 / 3);
console.log(parseInt(10 / 3)); // 정수로 변환 되면서 소수점이 전부 제거된다.
document.write(10 / 3 + "<br>");
document.write(parseInt(10 / 3) + "<br>");
console.log(10 % 3);
document.write(10 % 3 + "<br>");
</script>
Java
복사