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 class HelloWorld{
public static void main(String []args){
int s=7;
int k=1;
int r;
for(int i=1;i<=s;i++){
int num=1;
r=i;
int col=0;
for(int j=1;j<=2*s-1;j++){
if(j <= s-i)
System.out.print(" ");
else if(j >= s+i)
System.out.print(" ");
else{
if(k%2 ==0){
System.out.print(" ");
}
else{
if (col > 0) {
num = num * (r - col) / col;
}
System.out.print(num+" ");
col++;
}
k++;
}
}
System.out.println("");
k=1;
}
}
}