Hướng dẫn how do you print a hollow square in python? - làm thế nào để bạn in một hình vuông rỗng trong python?

Xem thảo luận

Cải thiện bài viết

Lưu bài viết

  • Đọc
  • Bàn luận
  • 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++

    #include

    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.

    for [i = 1; i < = rows; i++]
    7

    using namespace

    for [i = 1; i < = rows; i++]
    0

    for [i = 1; i < = rows; i++]
    1
    for [i = 1; i < = rows; i++]
    2
    for [i = 1; i < = rows; i++]
    3
    for [i = 1; i < = rows; i++]
    4
    for [i = 1; i < = rows; i++]
    3
    for [i = 1; i < = rows; i++]
    6

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    7

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    3
    for [j = 1; j < = columns; j++]
    0

    for [j = 1; j < = columns; j++]
    6
    for [i = 1; i < = rows; i++]
    7

    for [i = 1; i < = rows; i++]
    8
    for [j = 1; j < = columns; j++]
    2
    for [j = 1; j < = columns; j++]
    3

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    5

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    7
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    8
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    9

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    1

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    7
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    4
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    5

    for [j = 1; j < = columns; j++]
    6
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [j = 1; j < = columns; j++]
    6
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    9

    for [i = 1; i < = rows; i++]
    8
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [j = 1; j < = columns; j++]
    6
    for [j = 1; j < = columns; j++]
    2
    for [j = 1; j < = columns; j++]
    8

    for [i = 1; i < = rows; i++]
    7

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    2
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    3

    for [i = 1; i < = rows; i++]
    8
    ********
    **    **
    * *  * *
    *  **  *
    *  **  *
    * *  * *
    **    **
    ********
    0

    for [i = 1; i < = rows; i++]
    3
     if i == 1 or i == N or j == 1 or j == N
    4

    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    3
     if i == 1 or i == N or j == 1 or j == N
    8

    ********
    **    **
    * *  * *
    *  **  *
    *  **  *
    * *  * *
    **    **
    ********
    5

    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.

    for [i = 1; i < = rows; i++]
    7

    using namespace

    for [i = 1; i < = rows; i++]
    0

    for [i = 1; i < = rows; i++]
    1
    for [i = 1; i < = rows; i++]
    2
    for [i = 1; i < = rows; i++]
    3
    for [i = 1; i < = rows; i++]
    4
    for [i = 1; i < = rows; i++]
    3
    for [i = 1; i < = rows; i++]
    6

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    7

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    3
    for [j = 1; j < = columns; j++]
    0

    for [j = 1; j < = columns; j++]
    6
    for [i = 1; i < = rows; i++]
    7

    for [i = 1; i < = rows; i++]
    8
    for [j = 1; j < = columns; j++]
    2
    for [j = 1; j < = columns; j++]
    3

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4namespace0namespace1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    8namespace3

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    1

    for [j = 1; j < = columns; j++]
    6
    for [j = 1; j < = columns; j++]
    2
    for [j = 1; j < = columns; j++]
    8

    for [j = 1; j < = columns; j++]
    6
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [j = 1; j < = columns; j++]
    6namespace0namespace1
    for [i = 1; i < = rows; i++]
    06
    for [i = 1; i < = rows; i++]
    07

    for [i = 1; i < = rows; i++]
    8
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [j = 1; j < = columns; j++]
    6
    for [j = 1; j < = columns; j++]
    2
    for [j = 1; j < = columns; j++]
    8

    for [i = 1; i < = rows; i++]
    7

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    2
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    3

    for [i = 1; i < = rows; i++]
    8
    ********
    **    **
    * *  * *
    *  **  *
    *  **  *
    * *  * *
    **    **
    ********
    0

    for [i = 1; i < = rows; i++]
    3
     if i == 1 or i == N or j == 1 or j == N
    4

    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    3
     if i == 1 or i == N or j == 1 or j == N
    8

    for [i = 1; i < = rows; i++]
    8
    ********
    **    **
    * *  * *
    *  **  *
    *  **  *
    * *  * *
    **    **
    ********
    2
    ********
    **    **
    * *  * *
    *  **  *
    *  **  *
    * *  * *
    **    **
    ********
    3

    C

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    2 using8

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    7

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4namespace0namespace1
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    4namespace3

    Java

    for [j = 1; j < = columns; j++]
    6
    for [i = 1; i < = rows; i++]
    7

    for [i = 1; i < = rows; i++]
    23
    for [i = 1; i < = rows; i++]
    24

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    for [i = 1; i < = rows; i++]
    7

    for [i = 1; i < = rows; i++]
    25
    for [i = 1; i < = rows; i++]
    26

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    28
    for [i = 1; i < = rows; i++]
    1
    for [i = 1; i < = rows; i++]
    2
    for [i = 1; i < = rows; i++]
    3
    for [i = 1; i < = rows; i++]
    4
    for [i = 1; i < = rows; i++]
    3
    for [i = 1; i < = rows; i++]
    6

    for [i = 1; i < = rows; i++]
    59
    for [i = 1; i < = rows; i++]
    64
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    8namespace3

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    1

    for [i = 1; i < = rows; i++]
    59
    for [i = 1; i < = rows; i++]
    64
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    4namespace3

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    for [i = 1; i < = rows; i++]
    76

    for [j = 1; j < = columns; j++]
    6
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [i = 1; i < = rows; i++]
    8
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [j = 1; j < = columns; j++]
    6
    for [i = 1; i < = rows; i++]
    3
    for [j = 1; j < = columns; j++]
    0

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    7

    for [j = 1; j < = columns; j++]
    6
    for [j = 1; j < = columns; j++]
    2
    for [i = 1; i < = rows; i++]
    42
    for [i = 1; i < = rows; i++]
    43
    for [i = 1; i < = rows; i++]
    44

    for [j = 1; j < = columns; j++]
    6
    ********
    **    **
    * *  * *
    *  **  *
    *  **  *
    * *  * *
    **    **
    ********
    0

    for [i = 1; i < = rows; i++]
    8
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    Python3

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    for [j = 1; j < = columns; j++]
    2
    for [i = 1; i < = rows; i++]
    49
    for [i = 1; i < = rows; i++]
    43
    for [i = 1; i < = rows; i++]
    51

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    2
    for [i = 1; i < = rows; i++]
    56
    for [i = 1; i < = rows; i++]
    43
    for [i = 1; i < = rows; i++]
    58

    for [i = 1; i < = rows; i++]
    59
    for [i = 1; i < = rows; i++]
    60
    for [i = 1; i < = rows; i++]
    43
    for [i = 1; i < = rows; i++]
    62

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    82
    for [i = 1; i < = rows; i++]
    28
    for [i = 1; i < = rows; i++]
    1
    for [i = 1; i < = rows; i++]
    85

    for [j = 1; j < = columns; j++]
    6
    for [i = 1; i < = rows; i++]
    3
    for [i = 1; i < = rows; i++]
    90
    for [i = 1; i < = rows; i++]
    91
    for [i = 1; i < = rows; i++]
    92
    for [i = 1; i < = rows; i++]
    93
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    5

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    for [j = 1; j < = columns; j++]
    47namespace1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    8
    for [j = 1; j < = columns; j++]
    50
    for [j = 1; j < = columns; j++]
    27
    for [j = 1; j < = columns; j++]
    52

    for [j = 1; j < = columns; j++]
    00
    for [j = 1; j < = columns; j++]
    01

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    for [j = 1; j < = columns; j++]
    47namespace1
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    4
    for [j = 1; j < = columns; j++]
    50
    for [j = 1; j < = columns; j++]
    27
    for [j = 1; j < = columns; j++]
    52

    for [j = 1; j < = columns; j++]
    6
    for [j = 1; j < = columns; j++]
    47
    for [j = 1; j < = columns; j++]
    65

    for [i = 1; i < = rows; i++]
    8
    for [j = 1; j < = columns; j++]
    2
    for [j = 1; j < = columns; j++]
    04
    for [j = 1; j < = columns; j++]
    05
    for [j = 1; j < = columns; j++]
    06__91
    for [i = 1; i < = rows; i++]
    43
    for [j = 1; j < = columns; j++]
    09
    for [j = 1; j < = columns; j++]
    10____
    for [i = 1; i < = rows; i++]
    43
    for [j = 1; j < = columns; j++]
    12

    Các

    for [j = 1; j < = columns; j++]
    72

    C#

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    2
    for [j = 1; j < = columns; j++]
    26
    for [j = 1; j < = columns; j++]
    27
    for [j = 1; j < = columns; j++]
    27
    for [i = 1; i < = rows; i++]
    43
    for [j = 1; j < = columns; j++]
    30
    for [j = 1; j < = columns; j++]
    04__

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    for [j = 1; j < = columns; j++]
    15
    for [j = 1; j < = columns; j++]
    27
    for [j = 1; j < = columns; j++]
    27
    for [i = 1; i < = rows; i++]
    43

    for [i = 1; i < = rows; i++]
    7

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    1
    for [j = 1; j < = columns; j++]
    55

    for [j = 1; j < = columns; j++]
    79
    for [i = 1; i < = rows; i++]
    7

    using namespace

    for [i = 1; i < = rows; i++]
    0

    for [i = 1; i < = rows; i++]
    1
    for [i = 1; i < = rows; i++]
    2
    for [i = 1; i < = rows; i++]
    3
    for [i = 1; i < = rows; i++]
    4
    for [i = 1; i < = rows; i++]
    3
    for [i = 1; i < = rows; i++]
    6

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    7

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    3
    for [j = 1; j < = columns; j++]
    0

    for [j = 1; j < = columns; j++]
    97
    for [i = 1; i < = rows; i++]
    7

    for [i = 1; i < = rows; i++]
    8
    for [j = 1; j < = columns; j++]
    2
    for [j = 1; j < = columns; j++]
    3

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    06

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    07
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    08
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    8namespace3

    for [j = 1; j < = columns; j++]
    6
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    1

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    07
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    08
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    4namespace3

    for [j = 1; j < = columns; j++]
    97
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [j = 1; j < = columns; j++]
    97
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    20

    for [i = 1; i < = rows; i++]
    8
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [j = 1; j < = columns; j++]
    79
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [j = 1; j < = columns; j++]
    6
    for [j = 1; j < = columns; j++]
    2
    for [j = 1; j < = columns; j++]
    8

    for [j = 1; j < = columns; j++]
    79
    for [i = 1; i < = rows; i++]
    7

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    2
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    3

    for [i = 1; i < = rows; i++]
    8
    ********
    **    **
    * *  * *
    *  **  *
    *  **  *
    * *  * *
    **    **
    ********
    0

    for [j = 1; j < = columns; j++]
    79
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [i = 1; i < = rows; i++]
    3
     if i == 1 or i == N or j == 1 or j == N
    4

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    40

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    3
     if i == 1 or i == N or j == 1 or j == N
    8

    for [i = 1; i < = rows; i++]
    7

    for [i = 1; i < = rows; i++]
    8
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    49
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    5

    for [i = 1; i < = rows; i++]
    8
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    52
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    5

    for [i = 1; i < = rows; i++]
    8
    ********
    **    **
    * *  * *
    *  **  *
    *  **  *
    * *  * *
    **    **
    ********
    2
    ********
    **    **
    * *  * *
    *  **  *
    *  **  *
    * *  * *
    **    **
    ********
    3

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    7

    C

    for [j = 1; j < = columns; j++]
    6
    for [i = 1; i < = rows; i++]
    7

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    2 namespace1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    49
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    84__

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    52
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    84
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    52
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    86
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    45
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    95

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    97namespace1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    8
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    00

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    1

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    97namespace1
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    4
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    00

    for [j = 1; j < = columns; j++]
    6
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [j = 1; j < = columns; j++]
    6
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    97namespace1
    for [i = 1; i < = rows; i++]
    06
    for [i = 1; i < = rows; i++]
    07

    for [i = 1; i < = rows; i++]
    8
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [i = 1; i < = rows; i++]
    8
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    19
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    20

    for [i = 1; i < = rows; i++]
    8
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    22
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    23

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    2
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    19
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    44
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    22
    for [i = 1; i < = rows; i++]
    07

    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    30

    JavaScript

    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    31

    for [j = 1; j < = columns; j++]
    97
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    41
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    34

    for [j = 1; j < = columns; j++]
    97
    for [i = 1; i < = rows; i++]
    7

    for [j = 1; j < = columns; j++]
    6
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    38
    for [j = 1; j < = columns; j++]
    0

    for [j = 1; j < = columns; j++]
    6
    for [j = 1; j < = columns; j++]
    2
    for [j = 1; j < = columns; j++]
    3

    for [j = 1; j < = columns; j++]
    6
    for [i = 1; i < = rows; i++]
    7

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    07
    for [j = 1; j < = columns; j++]
    2
    for [j = 1; j < = columns; j++]
    8

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    07
    for [i = 1; i < = rows; i++]
    7

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    2
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    52

    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    53
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    54
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    8
    for [i = 1; i < = rows; i++]
    07

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    1

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    54
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    61
    for [i = 1; i < = rows; i++]
    07

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    07
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    07
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    54
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    67
    for [i = 1; i < = rows; i++]
    07

    for [j = 1; j < = columns; j++]
    6
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [j = 1; j < = columns; j++]
    97
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [j = 1; j < = columns; j++]
    97
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    38
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    75

    for [j = 1; j < = columns; j++]
    6
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    77

    for [j = 1; j < = columns; j++]
    97
    ********
    **    **
    * *  * *
    *  **  *
    *  **  *
    * *  * *
    **    **
    ********
    0

    for [i = 1; i < = rows; i++]
    8
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    81

    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:

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

    Explanation:   
     

    • 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++

    #include

    using namespace

    for [i = 1; i < = rows; i++]
    0

    for [i = 1; i < = rows; i++]
    1
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    87
    for [i = 1; i < = rows; i++]
    3
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    89

    for [i = 1; i < = rows; i++]
    7

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    3
    for [j = 1; j < = columns; j++]
    0

    for [i = 1; i < = rows; i++]
    8
    for [j = 1; j < = columns; j++]
    2
    for [j = 1; j < = columns; j++]
    3

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    7

    for [j = 1; j < = columns; j++]
    6
    for [j = 1; j < = columns; j++]
    2
     if i == 1 or i == N or j == 1 or j == N
    01

    for [j = 1; j < = columns; j++]
    6
    for [i = 1; i < = rows; i++]
    7

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    2
     if i == 1 or i == N or j == 1 or j == N
    06

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    7
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    8
     if i == 1 or i == N or j == 1 or j == N
    10

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    1   

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    7
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    4
     if i == 1 or i == N or j == 1 or j == N
    10

    for [j = 1; j < = columns; j++]
    6
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [j = 1; j < = columns; j++]
    6
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    7
    for [i = 1; i < = rows; i++]
    06
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    5

    for [i = 1; i < = rows; i++]
    8
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [i = 1; i < = rows; i++]
    3
     if i == 1 or i == N or j == 1 or j == N
    4

    for [i = 1; i < = rows; i++]
    7

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    3
     if i == 1 or i == N or j == 1 or j == N
    31

    for [i = 1; i < = rows; i++]
    8
     if i == 1 or i == N or j == 1 or j == N
    33

    for [i = 1; i < = rows; i++]
    8
    ********
    **    **
    * *  * *
    *  **  *
    *  **  *
    * *  * *
    **    **
    ********
    2
    ********
    **    **
    * *  * *
    *  **  *
    *  **  *
    * *  * *
    **    **
    ********
    3

    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    C

    ********
    **    **
    * *  * *
    *  **  *
    *  **  *
    * *  * *
    **    **
    ********
    5

    for [i = 1; i < = rows; i++]
    1
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    87
    for [i = 1; i < = rows; i++]
    3
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    89

    for [i = 1; i < = rows; i++]
    7

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    3
    for [j = 1; j < = columns; j++]
    0

    for [i = 1; i < = rows; i++]
    8
    for [j = 1; j < = columns; j++]
    2
    for [j = 1; j < = columns; j++]
    3

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    7

    for [j = 1; j < = columns; j++]
    6
    for [j = 1; j < = columns; j++]
    2
     if i == 1 or i == N or j == 1 or j == N
    01

    for [j = 1; j < = columns; j++]
    6
    for [i = 1; i < = rows; i++]
    7

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    2
     if i == 1 or i == N or j == 1 or j == N
    06

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4namespace0namespace1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    8namespace3

    for [i = 1; i < = rows; i++]
    3
     if i == 1 or i == N or j == 1 or j == N
    4

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4namespace0namespace1
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    4namespace3

    for [j = 1; j < = columns; j++]
    6
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [j = 1; j < = columns; j++]
    6namespace0namespace1
    for [i = 1; i < = rows; i++]
    06
    for [i = 1; i < = rows; i++]
    07

    for [i = 1; i < = rows; i++]
    8
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [i = 1; i < = rows; i++]
    3
     if i == 1 or i == N or j == 1 or j == N
    4

    for [i = 1; i < = rows; i++]
    7

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    3
     if i == 1 or i == N or j == 1 or j == N
    31

    for [i = 1; i < = rows; i++]
    8
     if i == 1 or i == N or j == 1 or j == N
    33

    for [i = 1; i < = rows; i++]
    8
    ********
    **    **
    * *  * *
    *  **  *
    *  **  *
    * *  * *
    **    **
    ********
    2
    ********
    **    **
    * *  * *
    *  **  *
    *  **  *
    * *  * *
    **    **
    ********
    3

    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    C

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    2
     if i == 1 or i == N or j == 1 or j == N
    59

    ________ 31 ________ 41 & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp; & nbsp;

    Java

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    7

    for [i = 1; i < = rows; i++]
    23
    for [i = 1; i < = rows; i++]
    24

    for [i = 1; i < = rows; i++]
    25
    for [i = 1; i < = rows; i++]
    26

    for [j = 1; j < = columns; j++]
    6
    for [i = 1; i < = rows; i++]
    7

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    28
    for [i = 1; i < = rows; i++]
    1
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    87
    for [i = 1; i < = rows; i++]
    3
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    89

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    for [i = 1; i < = rows; i++]
    7

    for [j = 1; j < = columns; j++]
    6
    for [i = 1; i < = rows; i++]
    3
    for [j = 1; j < = columns; j++]
    0

    for [j = 1; j < = columns; j++]
    6
    for [j = 1; j < = columns; j++]
    2
    for [i = 1; i < = rows; i++]
    42
    for [i = 1; i < = rows; i++]
    43
    for [i = 1; i < = rows; i++]
    44

    for [i = 1; i < = rows; i++]
    59
    for [i = 1; i < = rows; i++]
    64
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    8namespace3

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    1          

    for [i = 1; i < = rows; i++]
    59
    for [i = 1; i < = rows; i++]
    64
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    4namespace3

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    for [i = 1; i < = rows; i++]
    76

    for [j = 1; j < = columns; j++]
    6
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    for [j = 1; j < = columns; j++]
    2
    for [i = 1; i < = rows; i++]
    49
    for [i = 1; i < = rows; i++]
    43
    ********
    **    **
    * *  * *
    *  **  *
    *  **  *
    * *  * *
    **    **
    ********
    20

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    2
    for [i = 1; i < = rows; i++]
    56
    for [i = 1; i < = rows; i++]
    43
    for [i = 1; i < = rows; i++]
    58

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    7

    for [i = 1; i < = rows; i++]
    59
    for [i = 1; i < = rows; i++]
    60
    for [i = 1; i < = rows; i++]
    43
    ********
    **    **
    * *  * *
    *  **  *
    *  **  *
    * *  * *
    **    **
    ********
    31

    for [j = 1; j < = columns; j++]
    6
     if i == 1 or i == N or j == 1 or j == N
    33

    for [i = 1; i < = rows; i++]
    8
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    Python3

    for [i = 1; i < = rows; i++]
    8
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    82
    for [i = 1; i < = rows; i++]
    28
    for [i = 1; i < = rows; i++]
    1
    for [i = 1; i < = rows; i++]
    85

    for [j = 1; j < = columns; j++]
    6
    for [i = 1; i < = rows; i++]
    3
    for [i = 1; i < = rows; i++]
    90
    ********
    **    **
    * *  * *
    *  **  *
    *  **  *
    * *  * *
    **    **
    ********
    60
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    5

    for [j = 1; j < = columns; j++]
    00
    ********
    **    **
    * *  * *
    *  **  *
    *  **  *
    * *  * *
    **    **
    ********
    68

    for [i = 1; i < = rows; i++]
    8
    for [j = 1; j < = columns; j++]
    2
    for [j = 1; j < = columns; j++]
    04
    for [j = 1; j < = columns; j++]
    05
    for [j = 1; j < = columns; j++]
    06__91
    for [i = 1; i < = rows; i++]
    43
    for [j = 1; j < = columns; j++]
    09
    for [j = 1; j < = columns; j++]
    10____
    for [i = 1; i < = rows; i++]
    43
    for [j = 1; j < = columns; j++]
    12

    for [j = 1; j < = columns; j++]
    6
    for [j = 1; j < = columns; j++]
    2
    for [j = 1; j < = columns; j++]
    15
    for [j = 1; j < = columns; j++]
    05
    for [j = 1; j < = columns; j++]
    06____91
    for [i = 1; i < = rows; i++]
    43
    for [j = 1; j < = columns; j++]
    09
    for [j = 1; j < = columns; j++]
    10
    for [i = 1; i < = rows; i++]
    43
    for [j = 1; j < = columns; j++]
    12

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    2
    for [j = 1; j < = columns; j++]
    26
    for [j = 1; j < = columns; j++]
    27
    for [j = 1; j < = columns; j++]
    27
    for [i = 1; i < = rows; i++]
    43
    for [j = 1; j < = columns; j++]
    30
    for [j = 1; j < = columns; j++]
    04__

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    for [j = 1; j < = columns; j++]
    15
    for [j = 1; j < = columns; j++]
    27
    for [j = 1; j < = columns; j++]
    27
    for [i = 1; i < = rows; i++]
    43

    for [j = 1; j < = columns; j++]
    6
    for [j = 1; j < = columns; j++]
    47
    for [j = 1; j < = columns; j++]
    65

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    for [j = 1; j < = columns; j++]
    47namespace1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    8#include 17
    for [j = 1; j < = columns; j++]
    27
    for [j = 1; j < = columns; j++]
    52

    #include 36

    C#

    using

    for [j = 1; j < = columns; j++]
    74

    for [i = 1; i < = rows; i++]
    25
    for [i = 1; i < = rows; i++]
    26

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    28
    for [i = 1; i < = rows; i++]
    1 #include 44
    for [i = 1; i < = rows; i++]
    3
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    89

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    7

    for [j = 1; j < = columns; j++]
    6
    for [i = 1; i < = rows; i++]
    3
    for [j = 1; j < = columns; j++]
    0

    for [j = 1; j < = columns; j++]
    6
    for [j = 1; j < = columns; j++]
    2
    for [j = 1; j < = columns; j++]
    3

    for [j = 1; j < = columns; j++]
    6
    for [i = 1; i < = rows; i++]
    7

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    for [j = 1; j < = columns; j++]
    2
     if i == 1 or i == N or j == 1 or j == N
    01

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    for [i = 1; i < = rows; i++]
    7

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    2
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    3

    for [i = 1; i < = rows; i++]
    59#include 66

    for [i = 1; i < = rows; i++]
    59#include 68

    for [i = 1; i < = rows; i++]
    59
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    08
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    8
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    00

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    1       

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    08
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    4
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    00

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    20

    for [j = 1; j < = columns; j++]
    6
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [i = 1; i < = rows; i++]
    8
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    82
    for [i = 1; i < = rows; i++]
    28
    for [i = 1; i < = rows; i++]
    1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    29

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    7

    for [j = 1; j < = columns; j++]
    6
    for [i = 1; i < = rows; i++]
    3
     if i == 1 or i == N or j == 1 or j == N
    31

    for [j = 1; j < = columns; j++]
    6#include 98

    for [i = 1; i < = rows; i++]
    8
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    PHP

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    40

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    41 #include 44
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    43
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    46

    for [i = 1; i < = rows; i++]
    7

    for [i = 1; i < = rows; i++]
    8
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    49
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    5

    for [i = 1; i < = rows; i++]
    8
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    52
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    5

    for [i = 1; i < = rows; i++]
    8
    for [j = 1; j < = columns; j++]
    2namespace1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    49
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    58
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    49
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    60
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    43
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    62
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    49
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    64

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    7

    for [j = 1; j < = columns; j++]
    6
    for [j = 1; j < = columns; j++]
    2 namespace1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    52
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    58__

    for [j = 1; j < = columns; j++]
    6
    for [i = 1; i < = rows; i++]
    7

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    2namespace1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    49

    Is

    using65

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    49 using67

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4using69
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    8
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    00

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    1   

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    97
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    4using77

    for [j = 1; j < = columns; j++]
    6
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [j = 1; j < = columns; j++]
    6
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    97
    for [i = 1; i < = rows; i++]
    06
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    5

    for [i = 1; i < = rows; i++]
    8
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [i = 1; i < = rows; i++]
    8
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    19 using89

    for [i = 1; i < = rows; i++]
    8#include 44
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    19
    for [i = 1; i < = rows; i++]
    07

    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    30

    JavaScript

    using95

    for [i = 1; i < = rows; i++]
    8
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    41 using98

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    7

    for [j = 1; j < = columns; j++]
    6
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    38
    for [j = 1; j < = columns; j++]
    0

    for [j = 1; j < = columns; j++]
    6
    for [j = 1; j < = columns; j++]
    2
    for [j = 1; j < = columns; j++]
    3

    for [j = 1; j < = columns; j++]
    6
    for [i = 1; i < = rows; i++]
    7

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    for [j = 1; j < = columns; j++]
    2
     if i == 1 or i == N or j == 1 or j == N
    01

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    for [i = 1; i < = rows; i++]
    7

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    2
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    3

    for [i = 1; i < = rows; i++]
    59namespace18

    for [i = 1; i < = rows; i++]
    8
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    4
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    1          

    for [i = 1; i < = rows; i++]
    59
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    54
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    4namespace3

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    1
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    54
    for [i = 1; i < = rows; i++]
    06
    for [i = 1; i < = rows; i++]
    07

    for [j = 1; j < = columns; j++]
    6
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [i = 1; i < = rows; i++]
    8
    ********
    *      *
    *      *
    *      *
    *      *
    *      *
    *      *
    ********
    7

    for [i = 1; i < = rows; i++]
    8
    for [i = 1; i < = rows; i++]
    82
    for [i = 1; i < = rows; i++]
    28
    for [i = 1; i < = rows; i++]
    1
    ********************
    *                  *
    *                  *
    *                  *
    *                  *
    ********************
    29

    for [j = 1; j < = columns; j++]
    6
     if i == 1 or i == N or j == 1 or j == N
    33

    Output:  
     

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

    for [j = 1; j < = columns; j++]
    6
    for [i = 1; i < = rows; i++]
    3
     if i == 1 or i == N or j == 1 or j == N
    31
    O[n2], where n represents the given input.
    Auxiliary Space: O[1], no extra space is required, so it is a constant.


    Làm cách nào để in một mẫu vuông bằng Python?

    Mẫu - 9: Mẫu vuông bằng cách sử dụng với số..
    hàng = int [input ["Nhập số lượng hàng:"]].
    Đối với i trong phạm vi [1, hàng + 1]:.
    cho J trong phạm vi [1, hàng + 1]:.
    # Kiểm tra điều kiện nếu giá trị của J nhỏ hơn hoặc bằng ..
    # j sau đó in tôi nếu không in j ..
    Nếu J.
    in [i, end = ''].

    Làm cách nào để in một mẫu số vuông?

    Để in mẫu số vuông, chúng tôi cần hai vòng.Một vòng ngoài để lặp qua các hàng và thứ hai một vòng bên trong để lặp qua các cột.Chạy một vòng ngoài từ 1 đến tổng hàng.Cấu trúc vòng lặp sẽ trông giống như [i = 1; ifor[i=1; i

    Chủ Đề