Skip to content

Instantly share code, notes, and snippets.

@Kkan9ma
Created July 8, 2019 03:04
Show Gist options
  • Save Kkan9ma/03c530c87390e5fbe13d27d02dec40d5 to your computer and use it in GitHub Desktop.
Save Kkan9ma/03c530c87390e5fbe13d27d02dec40d5 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Gugudan</title>
</head>
<body>
<h1>구구단 배열로 구현하기</h1>
<script>
var results = [];
for (var i = 2; i <= 9; i ++) {
document.write("<h2>" + i + "단</h2>");
for (var j = 0; j < 9; j++) {
results[j] = i * (j + 1);
document.write(i + " * " + (j + 1) + " = " + results[j] + "<br>");
}
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment