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++;
2 Réponses
+ 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();
}
0
thank you