-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path013练习2.html
75 lines (65 loc) · 1.4 KB
/
013练习2.html
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="csd.js">
for(var i=0; i<8; i++) {
for(var k=1; k<=i+1; k++) {
document.write("u");
}
document.write("<br>");
}
/* 行数 空格数 字符数量
u 0 4 1
uu 1 3 2
uuu 2 2 3
uuuu 3 1 4
uuuuu 4 0 5
*/
for(var i=0; i<5; i++) {
for(var j=1; j<=4-i; j++) {
//打印空格
document.write(" ");
}
for(var k=1; k<=i+1; k++) {
//打印字符
document.write("u");
}
document.write("<br>");
}
/* 行数 空格 字符
uuuu 0 4 4 === 4+2*i
uuuuuu 1 3 6
uuuuuuuu 2 2 8
uuuuuuuuuu 3 1 10
uuuuuuuuuuuu 4 0 12
*/
for(var i=0; i<5; i++){
for(var j=1; j<=4-i; j++) {
document.write(" ");
}
for(var k=1; k<=4+2*i; k++) {
document.write("u");
}
document.write("<br>");
}
/*
u
u u
u u
u u
u u
u u
u
*/
for(var i=0; i<5; i++) {
for(var i=0; i<5; i++) {
console.log(i);
}
}
</script>
</head>
<body>
</body>
</html>