Hollow Rectangle Pattern Java Programming Code

Hollow Rectangle Pattern Java Programming Code Output:


Hollow Rectangle Pattern Simple Java Code:


public class HollowRectanglePattern {
    public static void hollow_rectangle(int totRows, int totCols) {
        // outer Loop
        for (int i = 1; i <= totRows; i++) {
            // inner - columns
            for (int j = 1; j <= totCols; j++) {
                // cell = (i,j)
                if (i == 1 || i == totRows || j == 1 || j == totCols) {
                    // boundary cells
                    System.out.print("*");
                } else {
                    System.out.print(" ");
                }
            }
            System.out.println();
        }

    }

    public static void main(String[] args) {
        hollow_rectangle(10, 15);
    }
}


Please Don't Received Call of Your Enemy. They hell Your life. Please Block then as soon as possible.

Noman, Nishan, Maruf, Amir, Samia Batch of 18 CSE in PCIU students are always disturbing me, without any reason They are very jealous of me, envy me and gossip about me all day long.

They abuse me all the time. I feel very sad about it. 

No comments:

Post a Comment

Max Sub Array Sum: Kadane's Algorithm

Code of: Max Sub Array Sum: Kadane's Algorithm. public class MaxSubArraySumKadanesALgorithm {     public static void Kadane ( int ...