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

ok i print 2^k

and i get


2
2 4 8
2 4 8 16 32
2 4 8 16 32 64 128
2 4 8 16 32 64 128 256 512
2 4 8 16 32 64 128 256 512 1024 2048
2 4 8 16 32 64 128 256 512 1024 2048 4096 8192
2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32768

So the value in the middle of each line will be 2^(n-1)? What is the maximum you accept for the value of n? Because the n will be used to determine the height of the pyramid. Also, the value in the middle could have different length. How would you deal with 1 digit, 2 digits, 3 digits, 4 digits, etc in the same column?

hi morderators can delete this thread please!!
and any one from cos102 DONT COPY THIS ull get busted so will I
and I completed this problem btw................

how to make pattern like this :

                  1
                1 2 1
              1 2 4 2 1
            1 2 4 8 4 2 1
         1 2 4 8 16 8 4 2 1
      1 2 4 8 16 32 16 8 4 2 1
   1 2 4 8 16 32 64 32 16 8 4 2 1
1 2 4 8 16 32 64 128 64 32 16 8 4 2 1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.