Print Star Pattern - 4 | Java Programs

Output:

*** Star Pattern 4 ***

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

Click Here For Java Online Compiler

Solution:

class StarPattern4 {

    public static void main(String args[]) {
        int rows = 6;
        System.out.println("*** Star Pattern 4 ***" + "\n");

        for (int i = rows; i >= 1; i--) {
            for (int j = 1; j < i; j++) {
                System.out.print(" ");
            }
            for (int k = rows; k >= i; k--) {
                System.out.print("*");

            }
            System.out.println("");
        }
    }
}
Share This :

Related Post

avatar

nice article.thank you for sharing useful info.
visit
web programming tutorial
welookups

delete 29 August 2018 at 20:07



sentiment_satisfied Emoticon