tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 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