0

Please I need Help. I want return a pyramid in the console. I cant do it by myself...

public class Program { public static void main(String[] args) { Program pro = new Program(); pro.drawPyramid(9); } public void drawPyramid(int pHeight){ int z=0; int i=1; int f=(pHeight*2-1)/2; int x=0; while(z!=pHeight) { while(f!=0){ System.out.print(" "); f--; } f=(pHeight *2-1)/2-1; while(x!=i){ System.out.print("*"); x++;

31st Mar 2017, 1:42 PM
Mar co
Mar co - avatar
2 ответов
+ 4
for(int i = 0; i < 5; i++){ for(int j = i; j < 5; j++){ System.out.print(" "); } for(int k = 0; k <= i; k++){ System.out.print("* "); } System.out.println(); }
1st Apr 2017, 12:44 AM
Heng Jun Xi
Heng Jun Xi - avatar
0
thank you
1st Apr 2017, 7:53 AM
Mar co
Mar co - avatar