Thursday, March 21, 2019

Write a program to draw an equilateral triangle full of '*'

#!/usr/bin/perl
#This is a Perl program to draw an equilateral triangle full of "*" symbols

Program to draw an equilateral triangle
Program to draw an equilateral triangle


use 5.14.0;
use warnings;

for (my $i=0; $i < 5; $i++ ){
for (my $j=$i; $j < 5; $j++ ){
print " ";
}
for (my $k = $i; $k > 0; $k-- ){
print "* ";
}
print "\n";
}

No comments:

Post a Comment