I've figured out the answer to my previous question, but now have an even bigger problem. The assignment was to create and run a program that can take any column and row then print the corresponding number.
I found this code online. I thinks it's the answer. I don't want the answer. I want to know why and how to do it:
#!/usr/bin/perl
for ($k=0;$k<10;$k++) {
$pascal[$k] = [];
push @{$pascal[$k]},1;
for ($l=1;$l<=$k;$l++) {
push @{$pascal[$k]},$pascal[$k-1][$l-1]+$pascal[$k-1][$l];
}
}
foreach (@pascal) {
$n_els = @{$_};
$nsp = 20 - 2 * $n_els;
$form = (" " x $nsp).("%4d" x $n_els)."\n";
printf $form, @{$_};
}
I really need it explained... in absolute layman's terms if it is at all possible.
-sobam15