점검
<script>
/*
[문제]
9656의 각 자릿수를 분리하여
천의 자릿수, 백의 자릿수, 십의 자릿수, 일의 자릿수를 출력하시오.
*/
/*
[출력예시]
9
6
5
6
*/
</script>
HTML
복사
풀이
<script>
/*
[문제]
9656의 각 자릿수를 분리하여
천의 자릿수, 백의 자릿수, 십의 자릿수, 일의 자릿수를 출력하시오.
*/
/*
[출력예시]
9
6
5
6
*/
let a = 9656;
let _1000 = parseInt(a / 1000);
let _100 = parseInt(a % 1000 / 100);
let _10 = parseInt(a % 100 / 10);
let _1 = a % 10
document.write(_1000, "<br>");
document.write(_100, "<br>");
document.write(_10, "<br>");
document.write(_1);
</script>
HTML
복사