Files
Aer/tests/pascal_triangle.aer
T

27 lines
474 B
Plaintext

import 'console';
class Program {
private int fun(int $y) {
int $result = 1;
for(int $z = 1; $z <= $y; $z++) {
$result *= $z;
}
return $result;
}
public void main() {
int $z;
int $y = 5;
for(int $x = 0; $x < $y; $x++) {
for($z = 0; $z <= ($y - $x - 2); $z++) {
Console::Print(' ');
}
for($z = 0; $z <= $x; $z++) {
Console::Print(($this->fun($x) / ($this->fun($z) * $this->fun($x - $z))) + ' ');
}
Console::Print("\n");
}
}
}