Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Pascal's triangle...

by Anonymous Monk
on Dec 04, 2019 at 04:19 UTC ( [id://11109643]=note: print w/replies, xml ) Need Help??


in reply to Pascal's triangle...

One more approach:
sub line { my @a1 = @_; my @b; push @b, " 1"; push @b, $a1[$_] + $a1[ $_ - 1 ] foreach ( 1 .. $#a1 + 1 ); return @b; } my @b = qw(1 1); my $s = 100; print " " x ($s), " 1\n"; foreach ( 2 .. shift ) { my $l = join " ", @b; print " " x ( $s - ( length $l ) / 2 ), "$l\n"; @b = line(@b); shift @b; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11109643]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2024-04-20 10:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found