Print Mirror Upper Star Triangle Pattern using java
Divide this into two parts Upper part Lower part Both parts are a mirror reflection of each other. And each part comprises 2 triangles. Therefore, In total, we have to print 4 triangles to get the desired pattern. Example 1: Upper Part // Importing input output classes import java.io.*; // Main Class class GFG { // Method 1 // To print upper part of the pattern private static void displayUpperPart(int size) { // Declaring variables for rows and columns // respectively int m, n; // Outer loop for rows for (m = size - 1; m >= 0; m--) { // Inner loop 1 // to print triangle 1 for (n = 0; n < m; n++) { // Printing whitespace System.out.print(" "); } // Inner loop 2 // to print triangle 2 for (n = m; n <= size - 1; n++) { // Printing star with whitespace System.out.print("*" + " "); } // By now done with one rpw so next line System.out.println(); } } //...