All pastes #354317 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-02-13 22:18 UTC
rendered paste body
public class pascalsTriangle
{
	public static int comb(int n, int m)
	{
		int returnValue;
		if ((n == 1) || (m == 0) || (n == m))
			returnValue = 1;
		else
			returnValue = comb(n-1,m) + comb(n-1,m-1);
		return returnValue;

	}

	public static void main(String[] args)
	{
		String tab="                      ";
		for(int i=0; i<=10; i++)
		{
			System.out.print(tab.substring(i));
			for(int j=0; j<=i; j++)
			{
				System.out.print(comb(i,j)+" ");
			}
			System.out.println();
		}
	}
}