Print Star Pattern - 9 | Java Programs

Output:

*** Star Pattern 9 ***

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

Click Here For Java Online Compiler

Solution:

/**
 *
 * @author Alee Ahmed Kolachi
 */
public class StarPattern9 {

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

        }
    }
}
Share This :

Related Post



sentiment_satisfied Emoticon