Print Star Pattern 8 - Java Programs

Output:

*** Star Pattern 8 ***

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

Click Here For Java Online Compiler

Solution:

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

    public static void main(String args[]) {
        int rows = 6;
        System.out.println("*** Star Pattern 8 ***" + "\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



sentiment_satisfied Emoticon