Using perl Syntax Highlighting
#!/usr/bin/perl
use strict;
my $num = 0;
my $i = 11;
sub Cubo_Up
{
while($num <=10)
{
print " " x ($i),"*" x ($num),"*" x($num - 1),"\n";
$num++;
$i--;
}
}
sub Cubo_Down
{
$num = 10;
$i = 0;
while($num >= 0)
{
print " " x ($i),"*" x ($num),"*" x($num + 1),"\n";
$num--;
$i++;
}
}
&Cubo_Up;
&Cubo_Down;
use strict;
my $num = 0;
my $i = 11;
sub Cubo_Up
{
while($num <=10)
{
print " " x ($i),"*" x ($num),"*" x($num - 1),"\n";
$num++;
$i--;
}
}
sub Cubo_Down
{
$num = 10;
$i = 0;
while($num >= 0)
{
print " " x ($i),"*" x ($num),"*" x($num + 1),"\n";
$num--;
$i++;
}
}
&Cubo_Up;
&Cubo_Down;
Coloreado en 0.004 segundos, usando GeSHi 1.0.8.4
y el resultado debe ser similar al siguiente...
- Código: Seleccionar todo
*
***
*****
*******
*********
***********
*************
***************
*****************
*******************
*********************
*******************
*****************
***************
*************
***********
*********
*******
*****
***
*