Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/Pascals-triangle/E/pascals-triangle-1.e
Normal file
20
Task/Pascals-triangle/E/pascals-triangle-1.e
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
def pascalsTriangle(n, out) {
|
||||
def row := [].diverge(int)
|
||||
out.print("<table style='text-align: center; border: 0; border-collapse: collapse;'>")
|
||||
for y in 1..n {
|
||||
out.print("<tr>")
|
||||
row.push(1)
|
||||
def skip := n - y
|
||||
if (skip > 0) {
|
||||
out.print(`<td colspan="$skip"></td>`)
|
||||
}
|
||||
for x => v in row {
|
||||
out.print(`<td>$v</td><td></td>`)
|
||||
}
|
||||
for i in (1..!y).descending() {
|
||||
row[i] += row[i - 1]
|
||||
}
|
||||
out.println("</tr>")
|
||||
}
|
||||
out.print("</table>")
|
||||
}
|
||||
7
Task/Pascals-triangle/E/pascals-triangle-2.e
Normal file
7
Task/Pascals-triangle/E/pascals-triangle-2.e
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
def out := <file:triangle.html>.textWriter()
|
||||
try {
|
||||
pascalsTriangle(15, out)
|
||||
} finally {
|
||||
out.close()
|
||||
}
|
||||
makeCommand("yourFavoriteWebBrowser")("triangle.html")
|
||||
Loading…
Add table
Add a link
Reference in a new issue