개념
<script>
/*
[연속 누적 거꾸로2 for문]
반복문을 사용해서 보기와 같이 출력하시오.
[보기]
9 9
7 16
5 21
3 24
1 25
*/
let total = 0;
let a = 9;
for(let i = 4; i >= 0; i --) {
total += a;
document.write(a, " ", total, "<br>");
a -= 2;
}
document.write("<br>");
let total2 = 0;
for(let i = 9; i >= 0; i -= 2) {
total2 += i;
document.write(i, " ", total2, "<br>");
}
</script>
HTML
복사


