Untitled

mail@pastecode.io avatar
unknown
java
a year ago
481 B
2
Indexable
Never
package school.mjc.stage0.loops.finalTask; 
  
 public class HalfPyramid { 
     public void printHalfPyramid(int cathetusLength) { 
         for (int i = 1; i <= cathetusLength; i++) { 
             System.out.println(" ".repeat(cathetusLength - i) + "*".repeat(i)); 
         } 
     } 
  
  
     public static void main(String[] args) { 
         new HalfPyramid().printHalfPyramid(8); 
     } 
 }