Print Star Pattern - 5 | Java Programs

Output:

*** Star Pattern 5 ***

******
 *****
  ****
   ***
    **
     *

Click Here For Java Online Compiler

Solution:

/**
 *
 * @author Alee Ahmed Kolachi
 */
class StarPattern5 {

    public static void main(String args[]) {
        int rows = 6;
        System.out.println("*** Star Pattern 5 ***" + "\n");
        for (int i = rows; i >= 1; i--) {
            for (int j = rows; j > i; j--) {
                System.out.print(" ");
            }
            for (int k = 1; k <= i; k++) {
                System.out.print("*");
            }
            System.out.println("");
        }
    }
}
Share This :

Related Post



sentiment_satisfied Emoticon