Help with a pascal's triangle program
807606Mar 28 2007 — edited Mar 28 2007I am trying to write a class that prints out the nth row of pascal's triangle as a string. I need to figure out how to approach the recursive method called "pascalize." I understand the recursive aspect of pascal's triangle... the first two and the last two numbers of each row can be determined without recursion, and then you work your way down to the base case, to determine the rest of the row.
Here's what I have so far:
import java.util.*;
public class pascalsTriangle
{
public static void main (String [] args)
{
Scanner scan = new Scanner (System.in);
System.out.println ("Please enter row of Pascal's Triangle to be printed");
int line = scan.nextInt();
System.out.println (pascalize(line));
}
private static String pascalize ( int num )
{
int[] row = new int[num];
//this is the area i find myself drawing a blank with.
}
}