Hướng dẫn print hollow rectangle in python - in hình chữ nhật rỗng trong python

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

Lưu bài viết

  • Đọc
  • Bàn luận
  • Cải thiện bài viết

    Lưu bài viết

    Đọc

    Bàn luận
     

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

    Explanation:   
     

    • 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;
       
    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 thế nào để bạn in một hình chữ nhật trong Python?

    long = int [input ["longueur:"]] larg = int [input ["lớn:"]] cho i trong phạm vi [dài]: if [i == 0] hoặc [i == dài - 1]: # # Kiểm tra xem nó là bản in đầu tiên hay cuối cùng ['*'* larg] # in toàn bộ hàng không có khoảng cách khác: # cho các hàng giữa Hàng có khoảng cách ở giữa.

    Làm thế nào để bạn in một hộp rỗng trong Python?

    Mẫu hộp rỗng trong Python Chúng tôi lưu trữ các giá trị này trong các hàng và cột biến.Sau đó, chúng tôi in một câu lệnh để biểu thị rằng chúng tôi đang in một mẫu hộp rỗng bằng print [].Sau đó, chúng tôi bắt đầu các vòng lặp lồng nhau để in mẫu hộp rỗng.Trước tiên chúng tôi bắt đầu một vòng lặp để in các hàng với phạm vi từ 0 đến hàng.using print[]. Then we start nested loops to print the hollow box pattern. We first start a for loop to print the rows with the range from 0 to rows.

    Làm thế nào để bạn tạo một mẫu hình chữ nhật trong Python?

    Để thực hiện một mẫu hình chữ nhật bằng cách sử dụng lập trình Python, chúng tôi sẽ sử dụng hai cho các vòng, một vòng ngoài và một vòng lặp lồng nhau: vòng ngoài: điều này được sử dụng để lặp lại số lượng hàng.Vòng lặp lồng bên trong: Điều này được sử dụng để lặp lại số lượng cột trong mỗi hàng.using two for loops, one outer and one nested loop: Outer loop: This is used to iterate over the number of rows. Inner nested loop: This is used to iterate over the number of columns in each row.

    Làm thế nào để bạn in một viên kim cương rỗng trong Python?

    # Số hàng..
    hàng = 5 ..
    # Phần trên của kim cương rỗng ..
    Đối với i trong phạm vi [1, hàng+1]:.
    Đối với J trong phạm vi [1, ROW-I+1]:.
    in ["", end = ""].
    cho J trong phạm vi [1, 2*i]:.

    Bài Viết Liên Quan

    Chủ Đề