Hình chữ nhật rỗng - 2
Tên chương trình này là hình chữ nhật rỗng - 2. Viết chương trình Python để hình chữ nhật rỗng - 2
Liên kết dưới đây chứa hình chữ nhật rỗng - 2 câu hỏi, giải thích và các trường hợp kiểm tra
//drive.google.com/file/d/1nWuk5uhqVJKhOJbg9IaBoW8S8FUrNSbX/view?usp=sharing
Chúng tôi cần đầu ra chính xác khi mã được chạy
M = int[input[]]
N = int[input[]]
print["+"+N*"-"+"+"]
for _ in range[M]:
print["|"+N*" "+"|"]
print["+"+N*"-"+"+"]
Tìm hiểu thêm về sự giúp đỡ của chúng tôi với các bài tập: Python
Trong bức ảnh này, chúng ta sẽ thảo luận về cách tạo ra một mẫu hình chữ nhật rỗng bằng cách sử dụng các ngôi sao trong Python.
Nhiều mẫu có thể được in bằng Python một khi bạn có độ bám mạnh mẽ đối với các vòng lặp. Ở đây, chúng tôi sẽ sử dụng các vòng for
đơn giản để tạo mẫu hình chữ nhật với các ngôi sao.
Sự mô tả
Để thực hiện một mẫu hình chữ nhật với lập trình Python, chúng tôi sẽ sử dụng 2 vòng lặp for
- một vòng ngoài và một vòng lặp lồng nhau:
- Vòng lặp bên ngoài: Lặp lại số lượng hàng.
- Vòng lặp lồng bên trong: lặp lại số lượng cột trong mỗi hàng.
Mã số
Chúng ta hãy nhìn vào đoạn mã bên dưới.
# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
Giải trình
- Trong dòng 2, chúng tôi lấy đầu vào cho số lượng hàng.
- Trong dòng 3, chúng tôi lấy đầu vào cho số lượng cột.
- Trong dòng 6, chúng tôi tạo một vòng
for
để lặp lại số lượng hàng. - Trong dòng 9, chúng tôi tạo một vòng lặp
for
để lặp qua số lượng cột. - Trong dòng 12 và 16, chúng tôi in mẫu.
3 Tạo mặt trên của hình chữ nhật.# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
4 Tạo mặt trên của hình chữ nhật.# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
5 Tạo mặt trái của hình chữ nhật.# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
6 Tạo mặt phải của hình chữ nhật.# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
- Tuyên bố
7 được sử dụng để ở trên cùng một dòng.# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
- Tuyên bố
8 được sử dụng để chuyển sang dòng tiếp theo.# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
Người đóng góp
Vinisha Maheshwari
Tên chương trình này là hình chữ nhật rỗng - 2. Viết chương trình Python để hình chữ nhật rỗng - 2
Liên kết dưới đây chứa hình chữ nhật rỗng - 2 câu hỏi, giải thích và các trường hợp kiểm tra
//drive.google.com/file/d/1nWuk5uhqVJKhOJbg9IaBoW8S8FUrNSbX/view?usp=sharing
Xem thảo luận
Cải thiện bài viết
Lưu bài viết
Xem thảo luận
Cải thiện bài viết
Lưu bài viết
Đọc
Bàn luận
******************** * * * * * * * * ********************
Mẫu sao hình chữ nhật rỗng:
- Nhiệm vụ được in dưới mô hình rỗng của kích thước đã cho. & Nbsp; & nbsp;
- Giải thích: & nbsp; & nbsp;
for [i = 1; i < = rows; i++]
- Số đầu vào của các hàng và cột.
for [j = 1; j < = columns; j++]
- Cho các hàng hình chữ nhật chạy vòng ngoài từ 1 đến các hàng. & Nbsp; & nbsp;
- Cho cột hình chữ nhật chạy vòng bên trong từ 1 đến cột. & Nbsp; & nbsp;
C++
9# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
In ngôi sao cho hàng đầu tiên hoặc cuối cùng hoặc cho cột đầu tiên hoặc cuối cùng, nếu không thì in không gian trống.
Sau khi in tất cả các cột của một hàng, in dòng mới sau vòng lặp bên trong.
******************** * * * * * * * * ********************9
******************** * * * * * * * * ********************0
******************** * * * * * * * * ********************1
******************** * * * * * * * * ********************2
******************** * * * * * * * * ********************3
******************** * * * * * * * * ********************4
******************** * * * * * * * * ********************5
******************** * * * * * * * * ********************6
******************** * * * * * * * * ********************5
******************** * * * * * * * * ********************8
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]0____25
for [i = 1; i < = rows; i++]2
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]0____9
for [i = 1; i < = rows; i++]5
for [j = 1; j < = columns; j++]6
for [j = 1; j < = columns; j++]7
for [j = 1; j < = columns; j++]6
for [j = 1; j < = columns; j++]9
******************** * * * * * * * * ********************0
******************** * * * * * * * * ********************1
for [j = 1; j < = columns; j++]3
******************** * * * * * * * * ********************3
for [j = 1; j < = columns; j++]6
for [j = 1; j < = columns; j++]9
******************** * * * * * * * * ********************6
******************** * * * * * * * * ********************7
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]8
******** * * * * * * * * * * * * ********1
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]8
for
for [j = 1; j < = columns; j++]0
******************** * * * * * * * * ********************9
for [j = 1; j < = columns; j++]3
for [j = 1; j < = columns; j++]4
for [j = 1; j < = columns; j++]5
for [i = 1; i < = rows; i++]0
if i == 1 or i == N or j == 1 or j == N2
******************** * * * * * * * * ********************5
******** * * * * * * * * * * * * ********6
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]
0____25 if i == 1 or i == N or j == 1 or j == N
0
if i == 1 or i == N or j == 1 or j == N7
Sau khi in tất cả các cột của một hàng, in dòng mới sau vòng lặp bên trong.
******************** * * * * * * * * ********************9
******************** * * * * * * * * ********************0
******************** * * * * * * * * ********************1
******************** * * * * * * * * ********************2
******************** * * * * * * * * ********************3
******************** * * * * * * * * ********************4
******************** * * * * * * * * ********************5
******************** * * * * * * * * ********************6
******************** * * * * * * * * ********************5
******************** * * * * * * * * ********************8
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]0____25
for [i = 1; i < = rows; i++]2
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]0____9
for [i = 1; i < = rows; i++]5
for [j = 1; j < = columns; j++]6
02# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
03# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************0
05# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [j = 1; j < = columns; j++]3
******************** * * * * * * * * ********************3
for [j = 1; j < = columns; j++]6
02# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
03# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************6
05# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]8
02# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
03# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
18# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
19# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]8
for
for [j = 1; j < = columns; j++]0
******************** * * * * * * * * ********************9
for [j = 1; j < = columns; j++]3
for [j = 1; j < = columns; j++]4
for [j = 1; j < = columns; j++]5
for [i = 1; i < = rows; i++]0
if i == 1 or i == N or j == 1 or j == N2
******************** * * * * * * * * ********************5
******** * * * * * * * * * * * * ********6
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]
0____25 if i == 1 or i == N or j == 1 or j == N
0
for [i = 1; i < = rows; i++]0____74
if i == 1 or i == N or j == 1 or j == N5
C
for [i = 1; i < = rows; i++]8
for
for [j = 1; j < = columns; j++]0
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
for [j = 1; j < = columns; j++]3
for [j = 1; j < = columns; j++]4
00# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
Java
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************9
35# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
36# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [j = 1; j < = columns; j++]3
******************** * * * * * * * * ********************9
37# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
38# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]0
40# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************3
******************** * * * * * * * * ********************4
******************** * * * * * * * * ********************5
******************** * * * * * * * * ********************6
******************** * * * * * * * * ********************5
******************** * * * * * * * * ********************8
71# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
76# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************0
05# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [j = 1; j < = columns; j++]6
******************** * * * * * * * * ********************3
71# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
76# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************6
05# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [j = 1; j < = columns; j++]3
******************** * * * * * * * * ********************9
for [j = 1; j < = columns; j++]3
88# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************5
for [i = 1; i < = rows; i++]2
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]8
for
54# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
55# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
56# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
for [j = 1; j < = columns; j++]3
for
61# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
55# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
63# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]8
if i == 1 or i == N or j == 1 or j == N2
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
******************** * * * * * * * * ********************9
Python3
for [j = 1; j < = columns; j++]6
for [j = 1; j < = columns; j++]4
68# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
55# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
70# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
71# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
72# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
55# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
74# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]0
94# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
40# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************3
97# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
Các
for [j = 1; j < = columns; j++]6
******************** * * * * * * * * ********************59
03# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************0
******************** * * * * * * * * ********************62
******************** * * * * * * * * ********************39
******************** * * * * * * * * ********************64
******************** * * * * * * * * ********************12
******************** * * * * * * * * ********************13
for [j = 1; j < = columns; j++]6
******************** * * * * * * * * ********************59
03# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************6
******************** * * * * * * * * ********************62
******************** * * * * * * * * ********************39
******************** * * * * * * * * ********************64
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************59
******************** * * * * * * * * ********************77
for [i = 1; i < = rows; i++]0____9
******************** * * * * * * * * ********************16
******************** * * * * * * * * ********************17
******************** * * * * * * * * ********************18
03# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
55# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************21
******************** * * * * * * * * ********************22222255555224
Is
******************** * * * * * * * * ********************84
C#
for [j = 1; j < = columns; j++]3
for [j = 1; j < = columns; j++]4
******************** * * * * * * * * ********************38
******************** * * * * * * * * ********************39
******************** * * * * * * * * ********************39
55# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************42
for [j = 1; j < = columns; j++]6
******************** * * * * * * * * ********************27
******************** * * * * * * * * ********************39
******************** * * * * * * * * ********************39
55# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************42
******************** * * * * * * * * ********************9
for [j = 1; j < = columns; j++]3
******************** * * * * * * * * ********************3
******************** * * * * * * * * ********************67
******************** * * * * * * * * ********************91
******************** * * * * * * * * ********************9
******************** * * * * * * * * ********************0
******************** * * * * * * * * ********************1
******************** * * * * * * * * ********************2
******************** * * * * * * * * ********************3
******************** * * * * * * * * ********************4
******************** * * * * * * * * ********************5
******************** * * * * * * * * ********************6
******************** * * * * * * * * ********************5
******************** * * * * * * * * ********************8
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]0____25
for [i = 1; i < = rows; i++]2
for [i = 1; i < = rows; i++]09
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]0____9
for [i = 1; i < = rows; i++]5
for [j = 1; j < = columns; j++]3
for [i = 1; i < = rows; i++]18
for [i = 1; i < = rows; i++]19
for [i = 1; i < = rows; i++]20
******************** * * * * * * * * ********************0
05# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************3
for [i = 1; i < = rows; i++]19
for [i = 1; i < = rows; i++]20
******************** * * * * * * * * ********************6
05# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]09
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]09
for [i = 1; i < = rows; i++]32
for [i = 1; i < = rows; i++]8
for
for [j = 1; j < = columns; j++]0
******************** * * * * * * * * ********************91
******************** * * * * * * * * ********************9
for [j = 1; j < = columns; j++]3
for [j = 1; j < = columns; j++]4
for [j = 1; j < = columns; j++]5
******************** * * * * * * * * ********************91
******************** * * * * * * * * ********************9
for [j = 1; j < = columns; j++]3
for [j = 1; j < = columns; j++]4
for [j = 1; j < = columns; j++]5
for [i = 1; i < = rows; i++]0
if i == 1 or i == N or j == 1 or j == N2
******************** * * * * * * * * ********************91
******************** * * * * * * * * ********************9
******************** * * * * * * * * ********************9
********************
* *
* *
* *
* *
********************
5 ********
* *
* *
* *
* *
* *
* *
********
6
for [i = 1; i < = rows; i++]52
for [i = 1; i < = rows; i++]0____25
if i == 1 or i == N or j == 1 or j == N0
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]0
for [i = 1; i < = rows; i++]61
******************** * * * * * * * * ********************7
for [i = 1; i < = rows; i++]0
for [i = 1; i < = rows; i++]64
******************** * * * * * * * * ********************7
for [i = 1; i < = rows; i++]0____74
if i == 1 or i == N or j == 1 or j == N5
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]8
for
03# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]64
for [i = 1; i < = rows; i++]70__364
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************9
for [j = 1; j < = columns; j++]3
for [j = 1; j < = columns; j++]4
03# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]61
for [i = 1; i < = rows; i++]96
for [i = 1; i < = rows; i++]61
for [i = 1; i < = rows; i++]98__
for [j = 1; j < = columns; j++]6
for [i = 1; i < = rows; i++]64
for [i = 1; i < = rows; i++]96
for [i = 1; i < = rows; i++]64
for [i = 1; i < = rows; i++]98
for [i = 1; i < = rows; i++]57
for [j = 1; j < = columns; j++]07
for [j = 1; j < = columns; j++]6
for [j = 1; j < = columns; j++]09
03# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************0
for [j = 1; j < = columns; j++]12
for [j = 1; j < = columns; j++]3
******************** * * * * * * * * ********************3
for [j = 1; j < = columns; j++]6
for [j = 1; j < = columns; j++]09
03# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************6
for [j = 1; j < = columns; j++]12
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]8
for [j = 1; j < = columns; j++]09
03# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
18# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
19# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]0
for [j = 1; j < = columns; j++]31
for [j = 1; j < = columns; j++]32
for [i = 1; i < = rows; i++]0
for [j = 1; j < = columns; j++]34
for [j = 1; j < = columns; j++]35
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************4
for [j = 1; j < = columns; j++]31
for [i = 1; i < = rows; i++]56
for [j = 1; j < = columns; j++]34
19# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [j = 1; j < = columns; j++]42
JavaScript
for [j = 1; j < = columns; j++]43
for [i = 1; i < = rows; i++]09
for [i = 1; i < = rows; i++]53
for [j = 1; j < = columns; j++]46
for [i = 1; i < = rows; i++]09
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]8
for [j = 1; j < = columns; j++]50
for [i = 1; i < = rows; i++]2
for [i = 1; i < = rows; i++]8
for
for [i = 1; i < = rows; i++]5
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]19____9
for [j = 1; j < = columns; j++]0
for [i = 1; i < = rows; i++]19
******************** * * * * * * * * ********************9
for [j = 1; j < = columns; j++]3
for [j = 1; j < = columns; j++]4
for [j = 1; j < = columns; j++]64
for [j = 1; j < = columns; j++]65
for [j = 1; j < = columns; j++]66
******************** * * * * * * * * ********************0
19# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [j = 1; j < = columns; j++]3
******************** * * * * * * * * ********************3
for [j = 1; j < = columns; j++]6
for [j = 1; j < = columns; j++]66
for [j = 1; j < = columns; j++]73
19# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]19
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]19
for [j = 1; j < = columns; j++]66
for [j = 1; j < = columns; j++]79
19# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]09
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]09
for [j = 1; j < = columns; j++]50
for [j = 1; j < = columns; j++]87
for [i = 1; i < = rows; i++]8
for [j = 1; j < = columns; j++]89
for [i = 1; i < = rows; i++]09
if i == 1 or i == N or j == 1 or j == N2
for [i = 1; i < = rows; i++]0
for [j = 1; j < = columns; j++]93
Output:
******************** * * * * * * * * ********************
Độ phức tạp về thời gian: O [M * N], trong đó M và N đại diện cho các đầu vào đã cho.AUXILIARITY: O [1], không cần thêm không gian, vì vậy nó là một hằng số.O[m * n], where m and n represents the given inputs.
Auxiliary Space: O[1], no extra space is required, so it is a constant.
Mô hình ngôi sao vuông rỗng:
******** * * * * * * * * * * * * ********
Giải thích: & nbsp; & nbsp;
- Số đầu vào của hàng.
- Đối với các hàng, một vòng ngoài từ 1 đến N.
- Cho các cột, một vòng bên trong từ 1 đến n
- Bên trong Ngôi sao in vòng bên trong cho hàng đầu tiên và cuối cùng hoặc cho cột đầu tiên và cuối cùng. Đó là In Star & nbsp; & nbsp;
if i == 1 or i == N or j == 1 or j == N
- nếu không thì in không gian.
- Sau khi in tất cả các cột của một hàng, in một dòng trống sau vòng lặp bên trong. & Nbsp; & nbsp;
C++
9# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************0
******************** * * * * * * * * ********************1
******************** * * * * * * * * ********************2
******************** * * * * * * * * ********************3
for [j = 1; j < = columns; j++]99
******************** * * * * * * * * ********************5
******************** * * * * * * * * ********************01
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]0____25
for [i = 1; i < = rows; i++]2
for [i = 1; i < = rows; i++]0____9
for [i = 1; i < = rows; i++]5
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]8
for
******************** * * * * * * * * ********************13
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************9
for [j = 1; j < = columns; j++]3
for [j = 1; j < = columns; j++]4
******************** * * * * * * * * ********************18
for [j = 1; j < = columns; j++]6
for [j = 1; j < = columns; j++]9
******************** * * * * * * * * ********************0
******************** * * * * * * * * ********************22
for [j = 1; j < = columns; j++]3
******************** * * * * * * * * ********************3
for [j = 1; j < = columns; j++]6
for [j = 1; j < = columns; j++]9
******************** * * * * * * * * ********************6
******************** * * * * * * * * ********************22
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]8
for [j = 1; j < = columns; j++]9
18# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************7
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
******************** * * * * * * * * ********************9
******************** * * * * * * * * ********************5
******** * * * * * * * * * * * * ********6
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]0____25
******************** * * * * * * * * ********************43
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************45
for [i = 1; i < = rows; i++]0____74
if i == 1 or i == N or j == 1 or j == N5
******************** * * * * * * * * ********************9
C
if i == 1 or i == N or j == 1 or j == N7
******************** * * * * * * * * ********************3
for [j = 1; j < = columns; j++]99
******************** * * * * * * * * ********************5
******************** * * * * * * * * ********************01
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]0____25
for [i = 1; i < = rows; i++]2
for [i = 1; i < = rows; i++]0____9
for [i = 1; i < = rows; i++]5
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]8
for
******************** * * * * * * * * ********************13
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************9
for [j = 1; j < = columns; j++]3
for [j = 1; j < = columns; j++]4
******************** * * * * * * * * ********************18
for [j = 1; j < = columns; j++]6
02# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
03# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************0
05# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************5
******** * * * * * * * * * * * * ********6
for [i = 1; i < = rows; i++]0____25
******************** * * * * * * * * ********************43
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]8
02# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
03# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
18# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
19# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
******************** * * * * * * * * ********************9
******************** * * * * * * * * ********************5
******** * * * * * * * * * * * * ********6
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]0____25
******************** * * * * * * * * ********************43
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************45
for [i = 1; i < = rows; i++]0____74
if i == 1 or i == N or j == 1 or j == N5
******************** * * * * * * * * ********************9
C
for [j = 1; j < = columns; j++]3
for [j = 1; j < = columns; j++]4
******************** * * * * * * * * ********************71
________ 43 ________ 53 & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp;
for [j = 1; j < = columns; j++]6
022.# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
Java
35# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
36# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************9
37# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
38# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [j = 1; j < = columns; j++]3
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]0
40# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************3
for [j = 1; j < = columns; j++]99
******************** * * * * * * * * ********************5
******************** * * * * * * * * ********************01
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************5
for [i = 1; i < = rows; i++]2
71# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
76# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************0
05# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [j = 1; j < = columns; j++]6
******************** * * * * * * * * ********************3
71# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
76# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************6
05# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [j = 1; j < = columns; j++]3
******************** * * * * * * * * ********************9
for [j = 1; j < = columns; j++]3
88# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]8
for
54# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
55# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
56# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
for [j = 1; j < = columns; j++]3
for
61# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
55# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******** * * * * * * * * * * * * ********32
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************45
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
******************** * * * * * * * * ********************9
Python3
for [j = 1; j < = columns; j++]6
for [j = 1; j < = columns; j++]4
68# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
55# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
70# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
71# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
72# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
55# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******** * * * * * * * * * * * * ********43
for [i = 1; i < = rows; i++]0
94# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
40# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************3
97# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************5
******************** * * * * * * * * ********************02
******** * * * * * * * * * * * * ********72
******************** * * * * * * * * ********************7
******************** * * * * * * * * ********************12
******** * * * * * * * * * * * * ********80
for [i = 1; i < = rows; i++]0____9
******************** * * * * * * * * ********************16
******************** * * * * * * * * ********************17
******************** * * * * * * * * ********************18
03# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
55# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************21
******************** * * * * * * * * ********************22222255555224
for [j = 1; j < = columns; j++]3
******************** * * * * * * * * ********************3
******************** * * * * * * * * ********************67
for [j = 1; j < = columns; j++]6
******************** * * * * * * * * ********************59
03# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************6
if i == 1 or i == N or j == 1 or j == N29
******************** * * * * * * * * ********************39
******************** * * * * * * * * ********************64
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************59
******************** * * * * * * * * ********************77
******************** * * * * * * * * ********************78
******************** * * * * * * * * ********************39
******** * * * * * * * * * * * * ********72
if i == 1 or i == N or j == 1 or j == N48
C#
******************** * * * * * * * * ********************0
******************** * * * * * * * * ********************86
37# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
38# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]0
40# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************3
if i == 1 or i == N or j == 1 or j == N56
******************** * * * * * * * * ********************5
******************** * * * * * * * * ********************01
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************5
for [i = 1; i < = rows; i++]2
for [i = 1; i < = rows; i++]8
for
for [i = 1; i < = rows; i++]5
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************9
for [j = 1; j < = columns; j++]3
for
******************** * * * * * * * * ********************13
for [j = 1; j < = columns; j++]3
******************** * * * * * * * * ********************9
for [j = 1; j < = columns; j++]6
for [j = 1; j < = columns; j++]4
for [j = 1; j < = columns; j++]5
71# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
if i == 1 or i == N or j == 1 or j == N78
71# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
if i == 1 or i == N or j == 1 or j == N80
71# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]20
******************** * * * * * * * * ********************0
for [j = 1; j < = columns; j++]12
for [j = 1; j < = columns; j++]6
******************** * * * * * * * * ********************3
for [j = 1; j < = columns; j++]6
for [i = 1; i < = rows; i++]20
******************** * * * * * * * * ********************6
for [j = 1; j < = columns; j++]12
for [j = 1; j < = columns; j++]3
******************** * * * * * * * * ********************9
for [j = 1; j < = columns; j++]3
for [i = 1; i < = rows; i++]32
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]0
94# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
40# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************3
for [i = 1; i < = rows; i++]41
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************5
******************** * * * * * * * * ********************43
for [i = 1; i < = rows; i++]8
******** ** ** * * * * * ** * * ** * * * * * ** ** ********10
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
******************** * * * * * * * * ********************9
PHP
for [i = 1; i < = rows; i++]52
for [i = 1; i < = rows; i++]53
if i == 1 or i == N or j == 1 or j == N56
for [i = 1; i < = rows; i++]55
for [i = 1; i < = rows; i++]58
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]0
for [i = 1; i < = rows; i++]61
******************** * * * * * * * * ********************7
for [i = 1; i < = rows; i++]0
for [i = 1; i < = rows; i++]64
******************** * * * * * * * * ********************7
Các
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]8
for
03# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]64
for [i = 1; i < = rows; i++]70__364
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************9
for [j = 1; j < = columns; j++]3
for [j = 1; j < = columns; j++]4
03# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [i = 1; i < = rows; i++]61
******** ** ** * * * * * ** * * ** * * * * * ** ** ********56__
******** ** ** * * * * * ** * * ** * * * * * ** ** ********64
for [i = 1; i < = rows; i++]64
for [i = 1; i < = rows; i++]98
for [i = 1; i < = rows; i++]55
******************** * * * * * * * * ********************42
for [i = 1; i < = rows; i++]61
for [i = 1; i < = rows; i++]98__
******** ** ** * * * * * ** * * ** * * * * * ** ** ********777____361
******** ** ** * * * * * ** * * ** * * * * * ** ** ********79
for [j = 1; j < = columns; j++]6
******** ** ** * * * * * ** * * ** * * * * * ** ** ********81
******************** * * * * * * * * ********************0
for [j = 1; j < = columns; j++]12
for [j = 1; j < = columns; j++]3
******************** * * * * * * * * ********************3
for [j = 1; j < = columns; j++]6
for [j = 1; j < = columns; j++]09
******************** * * * * * * * * ********************6
******** ** ** * * * * * ** * * ** * * * * * ** ** ********89
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]8
for [j = 1; j < = columns; j++]09
18# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************7
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]0
for [j = 1; j < = columns; j++]31
for
01for [i = 1; i < = rows; i++]0__756
for [j = 1; j < = columns; j++]31
19# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [j = 1; j < = columns; j++]42
JavaScript
for
07
for [i = 1; i < = rows; i++]0
for [i = 1; i < = rows; i++]53
for
10for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]8
for [j = 1; j < = columns; j++]50
for [i = 1; i < = rows; i++]2
for [i = 1; i < = rows; i++]8
for
for [i = 1; i < = rows; i++]5
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************9
for [j = 1; j < = columns; j++]3
for
******************** * * * * * * * * ********************13
for [j = 1; j < = columns; j++]3
******************** * * * * * * * * ********************9
for [j = 1; j < = columns; j++]6
for [j = 1; j < = columns; j++]4
for [j = 1; j < = columns; j++]5
71# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for
3071# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [j = 1; j < = columns; j++]66
******************** * * * * * * * * ********************0
05# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [j = 1; j < = columns; j++]6
******************** * * * * * * * * ********************3
71# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [j = 1; j < = columns; j++]66
******************** * * * * * * * * ********************6
05# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
for [j = 1; j < = columns; j++]3
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]0
94# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
40# Initialising Length and Breadth
rows = 3
columns = 6
# Loop through number of rows
for i in range[rows]:
# Loop through number of columns
for j in range[columns]:
# Printing Pattern
if[i == 0 or i == rows - 1 or j == 0 or j == columns - 1]:
print['*', end = ' ']
else:
print[' ', end = ' ']
print[]
******************** * * * * * * * * ********************3
for [i = 1; i < = rows; i++]41
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]0
******************** * * * * * * * * ********************9
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************5
******************** * * * * * * * * ********************43
for [i = 1; i < = rows; i++]8
******************** * * * * * * * * ********************45
Output:
******** ** ** * * * * * ** * * ** * * * * * ** ** ********
PHPO[n2], where n represents the given input.
Auxiliary Space: O[1], no extra space is required, so it is a constant.