-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample-06-07.html
More file actions
37 lines (37 loc) · 955 Bytes
/
Copy pathexample-06-07.html
File metadata and controls
37 lines (37 loc) · 955 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>큰 자리수와 낮은 자리수가 같은지 비교</title>
</head>
<body>
<h3>큰 자리수와 낮은 자리수가 같은지 비교</h3>
<hr>
<script>
let num = prompt("숫자 입력", "");
if(isFinite(num))
{
let n = parseInt(num);
if(n>0)
{
let small = n % 10;
while(n != 0)
{
big = n % 10;
n = Math.floor(n/10);
}
if(big == small) document.write("같음");
else document.write("틀림");
}
else
{
document.write(n + ": 음수나 0은 다루지 않습니다");
}
}
else
{
document.write(num + "는 숫자가 아닙니다.");
}
</script>
</body>
</html>