/
alexShibanov
/
556677
Обзор
Документация
Войти
/
alexShibanov
/
556677
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
rectangle.java
36 строк
796 B
Dipalikamboj
Create rectangle.java
06 окт 2023, 14:29
Не верифицирован
06 окт 2023, 14:29
4b34d98
Код
Авторство
О чём код?
// Java Program to print pattern // Square hollow pattern import java.util.*; public class GeeksForGeeks { // Function to demonstrate pattern public static void printPattern(int n) { int i, j; // outer loop to handle number of rows for (i = 0; i < n; i++) { // inner loop to handle number of columns for (j = 0; j < n; j++) { // star will print only when it is in first // row or last row or first column or last // column if (i == 0 || j == 0 || i == n - 1 || j == n - 1) { System.out.print("*"); } // otherwise print space only. else { System.out.print(" "); } } System.out.println(); } } // Driver Function public static void main(String args[]) { int n = 6; printPattern(n); } }