<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
body{
font-weight: 600;
}
</style>
</head>
<body>
<script>
function fn(a, d) {
var e = [".","#"],c = "", b = 0;
d *= a;
for (; b < d; b++) c += e[b % 2], (b + 1) % a || (c += "<br>",!(a % 2) && e.reverse());
return c
};
for (var i=8; i<13; i++) {
document.write("<h4>"+[i,i-7]+"</h4><br>"+fn(i,i-7)+"<br>")
}
</script>
</body>
</html>