Print half daimond star pattern
Program:
#!/usr/bin/perl
use strict;
use warnings;
my $size = 5;
for (my $i = 1; $i <= $size; $i++) {
for (my $j = 1; $j <= $i; $j++) {
print("*");
}
print("\n");
}
for (my $i = $size - 1; $i >= 1; $i--) {
for (my $j = 1; $j <= $i; $j++) {
print("*");
}
print("\n");
}
Output:
*
**
***
****
*****
****
***
**
*