The assignment is to create Pascal\'s Triangle without using arrays. I have the method that produces the values for the triangle below. The method accepts an integer for the
public static void main(String[] args)
{
int a, num;
for (int i = 0; i <= 4; i++)
{
num = 1;
a = i + 1;
for(int j=4;j>0;j--)
{
if(j>i)
System.out.print(" ");
}
for (int j = 0; j <= i; j++)
{
if (j > 0)
num = num * (a - j) / j;
System.out.print(num + " ");
}
System.out.println();
}
}
Code perfectly prints pascal triangle