Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Pascal Triangle

by hdb (Prior)
on Apr 02, 2013 at 08:32 UTC ( #1026619=CUFP: print w/ replies, xml ) Need Help??

In a recent Chatterbox discussion, the question was whether the Pascal triangle starts with row zero or one. This little script is to highlight why zero is the first row:

use strict; use warnings; my $n = 5; for (my $i=0; $i<=$n; ++$i ) { print " " x ($n-$i); print "/$i\\ " for 0..$i; print "\n"; print " " x ($n-$i); print "\\$_/ " for 0..$i; print "\n\n"; }

Comment on Pascal Triangle
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://1026619]
Approved by marto
Front-paged by Arunbear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (16)
As of 2015-07-30 13:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (271 votes), past polls