1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>continue 문</title></head>
<body>
<h3>3으로 나눈 나머지가 1인 수만 더하기</h3>
<hr>
<script>
var sum=0;
for(i=1; i<=10; i++) {
    if(i%3 != 1// 3으로 나눈 나머지가 1이 아닌 경우
        continue// 다음 반복으로 점프(i++ 코드로)
    document.write(i + " "); // 더하는 수 출력
    sum += i; // 합
}
document.write("합은 " + sum);
</script>
</body>
</html>
 
cs


Posted by 너래쟁이
: