A minha arvorezeca em tcl ;]
by Juvenal
#!/usr/bin/env tclsh
set chars 40
set bottom 4
set bott 4
set s " "
set f *
proc repeat {a b} {return [string repeat $a $b]}
for {set a 1;set b [expr ($chars / 2)*2];set x $bott;set y [expr ($chars - $bottom)+1]} {$a < = $chars||$x>1} {incr a 1;incr b -1} {
if {$a< =$chars} {set z [repeat $f $a];puts [repeat $s $b]$z$z} {
set z [repeat $f $bottom];puts [repeat $s $y]$z$z;incr x -1
}
}
Pega em Python:
i = 0
ast = "*"
while i < 5:
print ast
ast += "*"
i += 1
Abraço
Já agora em powershell :D
echo "Arvorezinha"; foreach($i in 1..5) {"*"*$i};