i have to do a pyramid with a pattern
like this
1
1 2 1
1 2 4 2 1
1 2 4 16 4 2 1
i just realized dani web didnt take my center pyrmaid thing it moved to the side no matter what spacing i did
this is the pattern but the height is not 4 as it is now, it is 8 and width is 15
so far i have done something like this
public class pyramid {
public static void main(String args[]){
int w = 8;
for(int count =1; count<=w;count++){
for(int a = 1; a<=w-count;a++){
System.out.printf(" ");
}
for(int k = 1; k<=2*count -1;k++){
System.out.printf(" 0 ");
}
System.out.println();
}
System.out.println();
}
}
can someone please help me