Print Star Pattern - 10 | Java Programs

Output:

*** Star Pattern 10 ***

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

Click Here For Java Online Compiler

Solution:

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

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

Related Post



sentiment_satisfied Emoticon