sobam15 0 Newbie Poster

I have to create and run a program that can take any column and row value and print the corresponding number.

I think I understand how to do this manually:

1. Initialize row and column ($i and $j).
2. Make sure row/column combination exists, row must be larger or equal to column (if).
3. Initialize formula (Pi,j = $i-$j+1/$j * Pi,j - 1) which will be represented by a product ($p).
4. Initialize counter ($c).
5. Place numbers in formula.
6. Find value.
8. Update/loop (until) counter reaches desired value.
9. Print product (print).
10. Stop.

I may have gotten a few things wrong in there, but I think that's the general idea.

Still, I'm stuck something awful on the code. Not that there's much of anything here, but I think I've gotten most of it wrong.

This is what I have so far:

$i=?;
$j=?;

$p=?;
$c=1;

if (?) {
   print $j<=$i;
} else {
until (?) {
   #update product
   #update counter
  }
  print $p
}

I don't just want the answer or anything, I'd really like to know how to do this.

Explaining it in "super-layman" terms would be great.

Thanks to anyone who can take the time to help.

-sobam15

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.