Bagaimana cara mencetak pola kotak persegi dengan python?

for (j = 1; j < = columns; j++)
0
for (j = 1; j < = columns; j++)
4
for (j = 1; j < = columns; j++)
5

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
9

for (j = 1; j < = columns; j++)
8
for (j = 1; j < = columns; j++)
4
********************
*                  *
*                  *
*                  *
*                  *
********************
0

for (j = 1; j < = columns; j++)
8
for (i = 1; i < = rows; i++)
9

********************
*                  *
*                  *
*                  *
*                  *
********************
3
********************
*                  *
*                  *
*                  *
*                  *
********************
4
********************
*                  *
*                  *
*                  *
*                  *
********************
5

********************
*                  *
*                  *
*                  *
*                  *
********************
6
********************
*                  *
*                  *
*                  *
*                  *
********************
7

________7______6

********************
*                  *
*                  *
*                  *
*                  *
********************
9
********
*      *
*      *
*      *
*      *
*      *
*      *
********
0
********
*      *
*      *
*      *
*      *
*      *
*      *
********
1

********************
*                  *
*                  *
*                  *
*                  *
********************
3
********
*      *
*      *
*      *
*      *
*      *
*      *
********
3

********************
*                  *
*                  *
*                  *
*                  *
********************
6
********************
*                  *
*                  *
*                  *
*                  *
********************
9
********
*      *
*      *
*      *
*      *
*      *
*      *
********
6
********
*      *
*      *
*      *
*      *
*      *
*      *
********
7

for (j = 1; j < = columns; j++)
8
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

for (j = 1; j < = columns; j++)
8
 if i == 1 or i == N or j == 1 or j == N
1

for (j = 1; j < = columns; j++)
0
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

 

********
*      *
*      *
*      *
*      *
*      *
*      *
********
_9

 

 if i == 1 or i == N or j == 1 or j == N
5

for (i = 1; i < = rows; i++)
5
 if i == 1 or i == N or j == 1 or j == N
7

for (i = 1; i < = rows; i++)
_9

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
5
********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
1

for (j = 1; j < = columns; j++)
0
********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
3

for (j = 1; j < = columns; j++)
0
********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
5
********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
6

********
*      *
*      *
*      *
*      *
*      *
*      *
********
_9

 

********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
8

********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
_9

C




// C++ code for hollow rectangle0

// C++ code for hollow rectangle_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++)
5
for (i = 1; i < = rows; i++)
6
for (i = 1; i < = rows; i++)
5
for (i = 1; i < = rows; i++)
8

for (i = 1; i < = rows; i++)
_9

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
5
for (j = 1; j < = columns; j++)
2

for (j = 1; j < = columns; j++)
0
for (j = 1; j < = columns; j++)
4
for (j = 1; j < = columns; j++)
5

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
9

for (j = 1; j < = columns; j++)
8
for (j = 1; j < = columns; j++)
4
********************
*                  *
*                  *
*                  *
*                  *
********************
0

for (j = 1; j < = columns; j++)
8
for (i = 1; i < = rows; i++)
9

********************
*                  *
*                  *
*                  *
*                  *
********************
3
********************
*                  *
*                  *
*                  *
*                  *
********************
4 using5

********************
*                  *
*                  *
*                  *
*                  *
********************
6using7using8
********
*      *
*      *
*      *
*      *
*      *
*      *
********
0
for (i = 1; i < = rows; i++)
00

********************
*                  *
*                  *
*                  *
*                  *
********************
3
********
*      *
*      *
*      *
*      *
*      *
*      *
********
3

********************
*                  *
*                  *
*                  *
*                  *
********************
6using7________868______8
********
*      *
*      *
*      *
*      *
*      *
*      *
********
6
for (i = 1; i < = rows; i++)
00

for (j = 1; j < = columns; j++)
8
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

for (j = 1; j < = columns; j++)
8using7________868______8
for (i = 1; i < = rows; i++)
13
for (i = 1; i < = rows; i++)
14

for (j = 1; j < = columns; j++)
0
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

 

********
*      *
*      *
*      *
*      *
*      *
*      *
********
_9

 

for (i = 1; i < = rows; i++)
_18

for (i = 1; i < = rows; i++)
5
 if i == 1 or i == N or j == 1 or j == N
7

for (i = 1; i < = rows; i++)
_9

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
5
********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
1

for (j = 1; j < = columns; j++)
0
********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
3

for (j = 1; j < = columns; j++)
0
********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
5
********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
6

********
*      *
*      *
*      *
*      *
*      *
*      *
********
_9

Jawa




for (i = 1; i < = rows; i++)
_31

for (i = 1; i < = rows; i++)
_32
for (i = 1; i < = rows; i++)
33

 

for (i = 1; i < = rows; i++)
_34
for (i = 1; i < = rows; i++)
35

for (j = 1; j < = columns; j++)
0

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
2

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
40
for (i = 1; i < = rows; i++)
3
for (i = 1; i < = rows; i++)
4
for (i = 1; i < = rows; i++)
5
for (i = 1; i < = rows; i++)
6
for (i = 1; i < = rows; i++)
5
for (i = 1; i < = rows; i++)
8

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
9

for (j = 1; j < = columns; j++)
8
for (i = 1; i < = rows; i++)
5
for (j = 1; j < = columns; j++)
2

for (j = 1; j < = columns; j++)
8
for (j = 1; j < = columns; j++)
4
for (i = 1; i < = rows; i++)
54
for (i = 1; i < = rows; i++)
55
for (i = 1; i < = rows; i++)
56

for (j = 1; j < = columns; j++)
8
for (i = 1; i < = rows; i++)
9

********************
*                  *
*                  *
*                  *
*                  *
********************
3
for (j = 1; j < = columns; j++)
4
for (i = 1; i < = rows; i++)
61
for (i = 1; i < = rows; i++)
55
for (i = 1; i < = rows; i++)
63

********************
*                  *
*                  *
*                  *
*                  *
********************
3
for (i = 1; i < = rows; i++)
9

********************
*                  *
*                  *
*                  *
*                  *
********************
6
********************
*                  *
*                  *
*                  *
*                  *
********************
4
for (i = 1; i < = rows; i++)
68
for (i = 1; i < = rows; i++)
55
for (i = 1; i < = rows; i++)
70

for (i = 1; i < = rows; i++)
_71
for (i = 1; i < = rows; i++)
72
for (i = 1; i < = rows; i++)
55
for (i = 1; i < = rows; i++)
74

for (i = 1; i < = rows; i++)
_71
for (i = 1; i < = rows; i++)
76
********
*      *
*      *
*      *
*      *
*      *
*      *
********
0
for (i = 1; i < = rows; i++)
00

********************
*                  *
*                  *
*                  *
*                  *
********************
6
********
*      *
*      *
*      *
*      *
*      *
*      *
********
3

for (i = 1; i < = rows; i++)
_71
for (i = 1; i < = rows; i++)
76
********
*      *
*      *
*      *
*      *
*      *
*      *
********
6
for (i = 1; i < = rows; i++)
00

********************
*                  *
*                  *
*                  *
*                  *
********************
3
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

********************
*                  *
*                  *
*                  *
*                  *
********************
3
for (i = 1; i < = rows; i++)
88

for (j = 1; j < = columns; j++)
8
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

for (i = 1; i < = rows; i++)
_91

for (j = 1; j < = columns; j++)
0
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

for (i = 1; i < = rows; i++)
_91

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
18

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
98
for (i = 1; i < = rows; i++)
40
for (i = 1; i < = rows; i++)
3
for (j = 1; j < = columns; j++)
01

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
9

for (j = 1; j < = columns; j++)
8
for (i = 1; i < = rows; i++)
5
for (j = 1; j < = columns; j++)
06
for (j = 1; j < = columns; j++)
07
for (j = 1; j < = columns; j++)
08
for (j = 1; j < = columns; j++)
09
********
*      *
*      *
*      *
*      *
*      *
*      *
********
7

for (j = 1; j < = columns; j++)
8
********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
3

for (j = 1; j < = columns; j++)
0
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

********
*      *
*      *
*      *
*      *
*      *
*      *
********
_9

 

for (j = 1; j < = columns; j++)
_16

Python3




for (j = 1; j < = columns; j++)
_17

 

for (j = 1; j < = columns; j++)
_18

for (j = 1; j < = columns; j++)
19
for (j = 1; j < = columns; j++)
20

for (j = 1; j < = columns; j++)
0

for (j = 1; j < = columns; j++)
0
for (j = 1; j < = columns; j++)
4
for (j = 1; j < = columns; j++)
24
for (j = 1; j < = columns; j++)
25
for (j = 1; j < = columns; j++)
26________868______8
for (i = 1; i < = rows; i++)
55
for (j = 1; j < = columns; j++)
29
for (j = 1; j < = columns; j++)
30
for (i = 1; i < = rows; i++)
55
for (j = 1; j < = columns; j++)
32

for (j = 1; j < = columns; j++)
8
for (j = 1; j < = columns; j++)
4
for (j = 1; j < = columns; j++)
35
for (j = 1; j < = columns; j++)
25
for (j = 1; j < = columns; j++)
26________868______8
for (i = 1; i < = rows; i++)
55
for (j = 1; j < = columns; j++)
40
for (j = 1; j < = columns; j++)
30
for (i = 1; i < = rows; i++)
55
for (j = 1; j < = columns; j++)
32

********************
*                  *
*                  *
*                  *
*                  *
********************
3
********************
*                  *
*                  *
*                  *
*                  *
********************
4
for (j = 1; j < = columns; j++)
46
for (j = 1; j < = columns; j++)
47
for (j = 1; j < = columns; j++)
47
for (i = 1; i < = rows; i++)
55
for (j = 1; j < = columns; j++)
50
for (j = 1; j < = columns; j++)
24
for (j = 1; j < = columns; j++)
47________0______47 ________0______0_5_____4____5

________7______6

for (j = 1; j < = columns; j++)
35
for (j = 1; j < = columns; j++)
47
for (j = 1; j < = columns; j++)
47
for (i = 1; i < = rows; i++)
55
for (j = 1; j < = columns; j++)
50
for (j = 1; j < = columns; j++)
35
for (j = 1; j < = columns; j++)
47
for (j = 1; j < = columns; j++)
47 ________0______65

********************
*                  *
*                  *
*                  *
*                  *
********************
6
for (j = 1; j < = columns; j++)
67using8
********
*      *
*      *
*      *
*      *
*      *
*      *
********
0
for (j = 1; j < = columns; j++)
70
for (j = 1; j < = columns; j++)
47
for (j = 1; j < = columns; j++)
72

********************
*                  *
*                  *
*                  *
*                  *
********************
3
********
*      *
*      *
*      *
*      *
*      *
*      *
********
3
for (j = 1; j < = columns; j++)
75

________7______6

for (j = 1; j < = columns; j++)
67using8
********
*      *
*      *
*      *
*      *
*      *
*      *
********
6
for (j = 1; j < = columns; j++)
70
for (j = 1; j < = columns; j++)
47
for (j = 1; j < = columns; j++)
72

for (j = 1; j < = columns; j++)
_8

for (j = 1; j < = columns; j++)
8
for (j = 1; j < = columns; j++)
67
for (j = 1; j < = columns; j++)
86

 

 

for (j = 1; j < = columns; j++)
_87

for (j = 1; j < = columns; j++)
88
for (j = 1; j < = columns; j++)
47
for (j = 1; j < = columns; j++)
07

for (j = 1; j < = columns; j++)
_91
for (j = 1; j < = columns; j++)
47
for (j = 1; j < = columns; j++)
09

for (j = 1; j < = columns; j++)
_94

 

 

for (j = 1; j < = columns; j++)
_95

C#




using

for (j = 1; j < = columns; j++)
97

for (i = 1; i < = rows; i++)
_98
for (i = 1; i < = rows; i++)
34
********************
*                  *
*                  *
*                  *
*                  *
********************
00

for (i = 1; i < = rows; i++)
_9

 

********************
*                  *
*                  *
*                  *
*                  *
********************
02
for (i = 1; i < = rows; i++)
2

********************
*                  *
*                  *
*                  *
*                  *
********************
02
for (i = 1; i < = rows; i++)
40
for (i = 1; i < = rows; i++)
3
for (i = 1; i < = rows; i++)
4
for (i = 1; i < = rows; i++)
5
for (i = 1; i < = rows; i++)
6
for (i = 1; i < = rows; i++)
5
for (i = 1; i < = rows; i++)
8

********************
*                  *
*                  *
*                  *
*                  *
********************
02
for (i = 1; i < = rows; i++)
9

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
5
for (j = 1; j < = columns; j++)
2

for (j = 1; j < = columns; j++)
0
for (j = 1; j < = columns; j++)
4
for (j = 1; j < = columns; j++)
5

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
9

********************
*                  *
*                  *
*                  *
*                  *
********************
22
for (j = 1; j < = columns; j++)
4
********************
*                  *
*                  *
*                  *
*                  *
********************
0

********************
*                  *
*                  *
*                  *
*                  *
********************
22
for (i = 1; i < = rows; i++)
9

for (j = 1; j < = columns; j++)
8
********************
*                  *
*                  *
*                  *
*                  *
********************
4
********************
*                  *
*                  *
*                  *
*                  *
********************
5

********************
*                  *
*                  *
*                  *
*                  *
********************
3
********************
*                  *
*                  *
*                  *
*                  *
********************
31

********************
*                  *
*                  *
*                  *
*                  *
********************
32
********************
*                  *
*                  *
*                  *
*                  *
********************
33
********
*      *
*      *
*      *
*      *
*      *
*      *
********
0
for (i = 1; i < = rows; i++)
00

for (j = 1; j < = columns; j++)
8
********
*      *
*      *
*      *
*      *
*      *
*      *
********
3

********************
*                  *
*                  *
*                  *
*                  *
********************
32
********************
*                  *
*                  *
*                  *
*                  *
********************
33
********
*      *
*      *
*      *
*      *
*      *
*      *
********
6
for (i = 1; i < = rows; i++)
00

********************
*                  *
*                  *
*                  *
*                  *
********************
22
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

********************
*                  *
*                  *
*                  *
*                  *
********************
22
********************
*                  *
*                  *
*                  *
*                  *
********************
45

for (j = 1; j < = columns; j++)
0
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

 

********************
*                  *
*                  *
*                  *
*                  *
********************
02
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

 

********************
*                  *
*                  *
*                  *
*                  *
********************
02
for (i = 1; i < = rows; i++)
18

********************
*                  *
*                  *
*                  *
*                  *
********************
02
for (i = 1; i < = rows; i++)
98
for (i = 1; i < = rows; i++)
40
for (i = 1; i < = rows; i++)
3
********************
*                  *
*                  *
*                  *
*                  *
********************
56

********************
*                  *
*                  *
*                  *
*                  *
********************
02
for (i = 1; i < = rows; i++)
9

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
5
********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
1

for (j = 1; j < = columns; j++)
0
********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
3

********************
*                  *
*                  *
*                  *
*                  *
********************
02
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

********
*      *
*      *
*      *
*      *
*      *
*      *
********
_9

 

********************
*                  *
*                  *
*                  *
*                  *
********************
_67

PHP




********************
*                  *
*                  *
*                  *
*                  *
********************
_68

********************
*                  *
*                  *
*                  *
*                  *
********************
_69

 

for (i = 1; i < = rows; i++)
_2

********************
*                  *
*                  *
*                  *
*                  *
********************
71
for (i = 1; i < = rows; i++)
4
********************
*                  *
*                  *
*                  *
*                  *
********************
73
********************
*                  *
*                  *
*                  *
*                  *
********************
74
********************
*                  *
*                  *
*                  *
*                  *
********************
75
********************
*                  *
*                  *
*                  *
*                  *
********************
76

for (i = 1; i < = rows; i++)
_9

for (j = 1; j < = columns; j++)
0
********************
*                  *
*                  *
*                  *
*                  *
********************
79
********
*      *
*      *
*      *
*      *
*      *
*      *
********
7

for (j = 1; j < = columns; j++)
0
********************
*                  *
*                  *
*                  *
*                  *
********************
82
********
*      *
*      *
*      *
*      *
*      *
*      *
********
7

for (j = 1; j < = columns; j++)
0
for (j = 1; j < = columns; j++)
4 using8
********************
*                  *
*                  *
*                  *
*                  *
********************
79 ________7______88
********************
*                  *
*                  *
*                  *
*                  *
********************
79
********************
*                  *
*                  *
*                  *
*                  *
********************
90
********************
*                  *
*                  *
*                  *
*                  *
********************
73
********
*      *
*      *
*      *
*      *
*      *
*      *
********
7________7______79________7______94

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
9

for (j = 1; j < = columns; j++)
8
for (j = 1; j < = columns; j++)
4 using8
********************
*                  *
*                  *
*                  *
*                  *
********************
82
********************
*                  *
*                  *
*                  *
*                  *
********************
88
********************
*                  *
*                  *
*                  *
*                  *
********************
82
********************
*                  *
*                  *
*                  *
*                  *
********************
90
********************
*                  *
*                  *
*                  *
*                  *
********************
75
********
*      *
*      *
*      *
*      *
*      *
*      *
********
7________7______82
********************
*                  *
*                  *
*                  *
*                  *
********************
_94

for (j = 1; j < = columns; j++)
8
for (i = 1; i < = rows; i++)
9

********************
*                  *
*                  *
*                  *
*                  *
********************
3
********************
*                  *
*                  *
*                  *
*                  *
********************
4 using8
********************
*                  *
*                  *
*                  *
*                  *
********************
79
********
*      *
*      *
*      *
*      *
*      *
*      *
********
14
********************
*                  *
*                  *
*                  *
*                  *
********************
79
********
*      *
*      *
*      *
*      *
*      *
*      *
********
16
********************
*                  *
*                  *
*                  *
*                  *
********************
73
********
*      *
*      *
*      *
*      *
*      *
*      *
********
18

________7______6

********************
*                  *
*                  *
*                  *
*                  *
********************
82
********
*      *
*      *
*      *
*      *
*      *
*      *
********
14
********************
*                  *
*                  *
*                  *
*                  *
********************
82
********
*      *
*      *
*      *
*      *
*      *
*      *
********
16
********************
*                  *
*                  *
*                  *
*                  *
********************
75
********
*      *
*      *
*      *
*      *
*      *
*      *
********
25

________7______6

********
*      *
*      *
*      *
*      *
*      *
*      *
********
27________868______8
********
*      *
*      *
*      *
*      *
*      *
*      *
********
0
********
*      *
*      *
*      *
*      *
*      *
*      *
********
30

********************
*                  *
*                  *
*                  *
*                  *
********************
3
********
*      *
*      *
*      *
*      *
*      *
*      *
********
3

********************
*                  *
*                  *
*                  *
*                  *
********************
6
********
*      *
*      *
*      *
*      *
*      *
*      *
********
27________868______8
********
*      *
*      *
*      *
*      *
*      *
*      *
********
6
********
*      *
*      *
*      *
*      *
*      *
*      *
********
30

for (j = 1; j < = columns; j++)
8
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

for (j = 1; j < = columns; j++)
8
********
*      *
*      *
*      *
*      *
*      *
*      *
********
27________868______8
for (i = 1; i < = rows; i++)
13
for (i = 1; i < = rows; i++)
14

for (j = 1; j < = columns; j++)
0
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

 

********
*      *
*      *
*      *
*      *
*      *
*      *
********
_9

 

for (j = 1; j < = columns; j++)
0
 if i == 1 or i == N or j == 1 or j == N
5

for (j = 1; j < = columns; j++)
0
********
*      *
*      *
*      *
*      *
*      *
*      *
********
51
********
*      *
*      *
*      *
*      *
*      *
*      *
********
52

for (j = 1; j < = columns; j++)
0
********
*      *
*      *
*      *
*      *
*      *
*      *
********
54
********
*      *
*      *
*      *
*      *
*      *
*      *
********
55

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
4
********
*      *
*      *
*      *
*      *
*      *
*      *
********
51
********************
*                  *
*                  *
*                  *
*                  *
********************
74
********
*      *
*      *
*      *
*      *
*      *
*      *
********
54
for (i = 1; i < = rows; i++)
14

 

********
*      *
*      *
*      *
*      *
*      *
*      *
********
_62

********
*      *
*      *
*      *
*      *
*      *
*      *
********
_63

Javascript




********
*      *
*      *
*      *
*      *
*      *
*      *
********
_64

********************
*                  *
*                  *
*                  *
*                  *
********************
22
********
*      *
*      *
*      *
*      *
*      *
*      *
********
66

********************
*                  *
*                  *
*                  *
*                  *
********************
22
for (i = 1; i < = rows; i++)
2

********************
*                  *
*                  *
*                  *
*                  *
********************
22
********************
*                  *
*                  *
*                  *
*                  *
********************
71
********
*      *
*      *
*      *
*      *
*      *
*      *
********
71

********************
*                  *
*                  *
*                  *
*                  *
********************
22
for (i = 1; i < = rows; i++)
9

for (j = 1; j < = columns; j++)
8
********
*      *
*      *
*      *
*      *
*      *
*      *
********
75
for (j = 1; j < = columns; j++)
2

for (j = 1; j < = columns; j++)
8
for (j = 1; j < = columns; j++)
4
for (j = 1; j < = columns; j++)
5

for (j = 1; j < = columns; j++)
8
for (i = 1; i < = rows; i++)
9

********************
*                  *
*                  *
*                  *
*                  *
********************
32
for (j = 1; j < = columns; j++)
4
********************
*                  *
*                  *
*                  *
*                  *
********************
0

********************
*                  *
*                  *
*                  *
*                  *
********************
32
for (i = 1; i < = rows; i++)
9

********************
*                  *
*                  *
*                  *
*                  *
********************
3
********************
*                  *
*                  *
*                  *
*                  *
********************
4
********
*      *
*      *
*      *
*      *
*      *
*      *
********
89

********
*      *
*      *
*      *
*      *
*      *
*      *
********
90
********
*      *
*      *
*      *
*      *
*      *
*      *
********
91
********
*      *
*      *
*      *
*      *
*      *
*      *
********
0
for (i = 1; i < = rows; i++)
14

********************
*                  *
*                  *
*                  *
*                  *
********************
3
********
*      *
*      *
*      *
*      *
*      *
*      *
********
3

********************
*                  *
*                  *
*                  *
*                  *
********************
6
********
*      *
*      *
*      *
*      *
*      *
*      *
********
91
********
*      *
*      *
*      *
*      *
*      *
*      *
********
98
for (i = 1; i < = rows; i++)
14

********************
*                  *
*                  *
*                  *
*                  *
********************
32
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

********************
*                  *
*                  *
*                  *
*                  *
********************
32
********
*      *
*      *
*      *
*      *
*      *
*      *
********
91
 if i == 1 or i == N or j == 1 or j == N
04
for (i = 1; i < = rows; i++)
14

for (j = 1; j < = columns; j++)
8
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

********************
*                  *
*                  *
*                  *
*                  *
********************
22
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

 

********************
*                  *
*                  *
*                  *
*                  *
********************
22
 if i == 1 or i == N or j == 1 or j == N
5

********************
*                  *
*                  *
*                  *
*                  *
********************
22
********
*      *
*      *
*      *
*      *
*      *
*      *
********
75
 if i == 1 or i == N or j == 1 or j == N
14

for (j = 1; j < = columns; j++)
8
 if i == 1 or i == N or j == 1 or j == N
16

********************
*                  *
*                  *
*                  *
*                  *
********************
22
********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
3

********************
*                  *
*                  *
*                  *
*                  *
********************
_22

********************
*                  *
*                  *
*                  *
*                  *
********************
22
 if i == 1 or i == N or j == 1 or j == N
21

for (j = 1; j < = columns; j++)
0
 if i == 1 or i == N or j == 1 or j == N
23

Keluaran.  
 

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

Kompleksitas Waktu. O(m * n), di mana m dan n mewakili input yang diberikan
Ruang Bantu. O(1), tidak diperlukan ruang ekstra, jadi ini adalah konstanta

Pola bintang persegi berongga

 

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

Penjelasan.  
 

  • Masukkan jumlah baris
  • Untuk baris, loop luar dari 1 hingga N
  • Untuk kolom, loop dalam dari 1 hingga N
  • Di dalam lingkaran dalam, cetak bintang untuk baris pertama dan terakhir atau untuk kolom pertama dan terakhir. Yang merupakan bintang cetak
     
 if i == 1 or i == N or j == 1 or j == N
  • jika tidak, ruang cetak
  • Setelah mencetak semua kolom dalam satu baris, cetak baris kosong setelah putaran dalam.  
     

 

Direkomendasikan. Harap coba pendekatan Anda pada {IDE} terlebih dahulu, sebelum melanjutkan ke solusi

 

C++




 if i == 1 or i == N or j == 1 or j == N
_24

#include <bits/stdc++.h>

using

for (i = 1; i < = rows; i++)
0
for (i = 1; i < = rows; i++)
1

 

 if i == 1 or i == N or j == 1 or j == N
_29

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++)
5
 if i == 1 or i == N or j == 1 or j == N
33

for (i = 1; i < = rows; i++)
_9

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
5
for (j = 1; j < = columns; j++)
2

for (j = 1; j < = columns; j++)
0

for (j = 1; j < = columns; j++)
0
for (j = 1; j < = columns; j++)
4
for (j = 1; j < = columns; j++)
5

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
9

for (j = 1; j < = columns; j++)
8
for (j = 1; j < = columns; j++)
4
 if i == 1 or i == N or j == 1 or j == N
46

for (j = 1; j < = columns; j++)
8
for (i = 1; i < = rows; i++)
9

********************
*                  *
*                  *
*                  *
*                  *
********************
3
********************
*                  *
*                  *
*                  *
*                  *
********************
4
 if i == 1 or i == N or j == 1 or j == N
51

********************
*                  *
*                  *
*                  *
*                  *
********************
6
********************
*                  *
*                  *
*                  *
*                  *
********************
9
********
*      *
*      *
*      *
*      *
*      *
*      *
********
0
 if i == 1 or i == N or j == 1 or j == N
55

********************
*                  *
*                  *
*                  *
*                  *
********************
3
********
*      *
*      *
*      *
*      *
*      *
*      *
********
3

________7______6

********************
*                  *
*                  *
*                  *
*                  *
********************
9
********
*      *
*      *
*      *
*      *
*      *
*      *
********
6
 if i == 1 or i == N or j == 1 or j == N
55

for (j = 1; j < = columns; j++)
8
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

for (j = 1; j < = columns; j++)
8
********************
*                  *
*                  *
*                  *
*                  *
********************
9
for (i = 1; i < = rows; i++)
13
********
*      *
*      *
*      *
*      *
*      *
*      *
********
7

for (j = 1; j < = columns; j++)
0
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

 

********
*      *
*      *
*      *
*      *
*      *
*      *
********
_9

 

 if i == 1 or i == N or j == 1 or j == N
71

for (i = 1; i < = rows; i++)
5
 if i == 1 or i == N or j == 1 or j == N
7

for (i = 1; i < = rows; i++)
_9

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
5
 if i == 1 or i == N or j == 1 or j == N
77

for (j = 1; j < = columns; j++)
0
 if i == 1 or i == N or j == 1 or j == N
79

for (j = 1; j < = columns; j++)
0
********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
5
********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
6

********
*      *
*      *
*      *
*      *
*      *
*      *
********
_9

 

 if i == 1 or i == N or j == 1 or j == N
_84

C




 if i == 1 or i == N or j == 1 or j == N
_85

// C++ code for hollow rectangle_1

 

 if i == 1 or i == N or j == 1 or j == N
_29

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++)
5
 if i == 1 or i == N or j == 1 or j == N
33

for (i = 1; i < = rows; i++)
_9

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
5
for (j = 1; j < = columns; j++)
2

for (j = 1; j < = columns; j++)
0

for (j = 1; j < = columns; j++)
0
for (j = 1; j < = columns; j++)
4
for (j = 1; j < = columns; j++)
5

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
9

for (j = 1; j < = columns; j++)
8
for (j = 1; j < = columns; j++)
4
 if i == 1 or i == N or j == 1 or j == N
46

for (j = 1; j < = columns; j++)
8
for (i = 1; i < = rows; i++)
9

********************
*                  *
*                  *
*                  *
*                  *
********************
3
********************
*                  *
*                  *
*                  *
*                  *
********************
4
********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
09

********************
*                  *
*                  *
*                  *
*                  *
********************
6using7using8
********
*      *
*      *
*      *
*      *
*      *
*      *
********
0
for (i = 1; i < = rows; i++)
00

********************
*                  *
*                  *
*                  *
*                  *
********************
3
********
*      *
*      *
*      *
*      *
*      *
*      *
********
3

********************
*                  *
*                  *
*                  *
*                  *
********************
6using7________868______8
********
*      *
*      *
*      *
*      *
*      *
*      *
********
6
for (i = 1; i < = rows; i++)
00

for (j = 1; j < = columns; j++)
8
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

for (j = 1; j < = columns; j++)
8using7________868______8
for (i = 1; i < = rows; i++)
13
for (i = 1; i < = rows; i++)
14

for (j = 1; j < = columns; j++)
0
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

 

********
*      *
*      *
*      *
*      *
*      *
*      *
********
_9

 

 if i == 1 or i == N or j == 1 or j == N
71

for (i = 1; i < = rows; i++)
5
 if i == 1 or i == N or j == 1 or j == N
7

for (i = 1; i < = rows; i++)
_9

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
5
 if i == 1 or i == N or j == 1 or j == N
77

for (j = 1; j < = columns; j++)
0
 if i == 1 or i == N or j == 1 or j == N
79

for (j = 1; j < = columns; j++)
0
********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
5
********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
6

********
*      *
*      *
*      *
*      *
*      *
*      *
********
_9

Jawa




********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
_45

for (i = 1; i < = rows; i++)
_32
for (i = 1; i < = rows; i++)
33

 

for (i = 1; i < = rows; i++)
_34
for (i = 1; i < = rows; i++)
35

for (j = 1; j < = columns; j++)
0

for (j = 1; j < = columns; j++)
0
 if i == 1 or i == N or j == 1 or j == N
29

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
40
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++)
5
 if i == 1 or i == N or j == 1 or j == N
33

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
9

for (j = 1; j < = columns; j++)
8
for (i = 1; i < = rows; i++)
5
for (j = 1; j < = columns; j++)
2

********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
_64

for (j = 1; j < = columns; j++)
8
for (j = 1; j < = columns; j++)
4
for (i = 1; i < = rows; i++)
54
for (i = 1; i < = rows; i++)
55
for (i = 1; i < = rows; i++)
56

for (j = 1; j < = columns; j++)
8
for (i = 1; i < = rows; i++)
9

********************
*                  *
*                  *
*                  *
*                  *
********************
3
for (j = 1; j < = columns; j++)
4
for (i = 1; i < = rows; i++)
61
for (i = 1; i < = rows; i++)
55
********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
76

********************
*                  *
*                  *
*                  *
*                  *
********************
3
for (i = 1; i < = rows; i++)
9

********************
*                  *
*                  *
*                  *
*                  *
********************
6
********************
*                  *
*                  *
*                  *
*                  *
********************
4
for (i = 1; i < = rows; i++)
68
for (i = 1; i < = rows; i++)
55
for (i = 1; i < = rows; i++)
70

for (i = 1; i < = rows; i++)
_71
for (i = 1; i < = rows; i++)
72
for (i = 1; i < = rows; i++)
55
********
**    **
* *  * *
*  **  *
*  **  *
* *  * *
**    **
********
87

for (i = 1; i < = rows; i++)
_71
for (i = 1; i < = rows; i++)
76
********
*      *
*      *
*      *
*      *
*      *
*      *
********
0
for (i = 1; i < = rows; i++)
00

********************
*                  *
*                  *
*                  *
*                  *
********************
6
********
*      *
*      *
*      *
*      *
*      *
*      *
********
3

for (i = 1; i < = rows; i++)
_71
for (i = 1; i < = rows; i++)
76
********
*      *
*      *
*      *
*      *
*      *
*      *
********
6
for (i = 1; i < = rows; i++)
00

********************
*                  *
*                  *
*                  *
*                  *
********************
3
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

********************
*                  *
*                  *
*                  *
*                  *
********************
3
for (i = 1; i < = rows; i++)
88

for (j = 1; j < = columns; j++)
8
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

for (i = 1; i < = rows; i++)
_91

for (j = 1; j < = columns; j++)
0
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

for (i = 1; i < = rows; i++)
_91

for (j = 1; j < = columns; j++)
0
 if i == 1 or i == N or j == 1 or j == N
71

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
98
for (i = 1; i < = rows; i++)
40
for (i = 1; i < = rows; i++)
3
for (j = 1; j < = columns; j++)
01

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
9

for (j = 1; j < = columns; j++)
8
for (i = 1; i < = rows; i++)
5
for (j = 1; j < = columns; j++)
06// C++ code for hollow rectangle20
********
*      *
*      *
*      *
*      *
*      *
*      *
********
7

for (j = 1; j < = columns; j++)
8
 if i == 1 or i == N or j == 1 or j == N
79

for (j = 1; j < = columns; j++)
0
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

********
*      *
*      *
*      *
*      *
*      *
*      *
********
_9

 

for (j = 1; j < = columns; j++)
_16

Python3




// C++ code for hollow rectangle_28

 

// C++ code for hollow rectangle_29

for (j = 1; j < = columns; j++)
19 // C++ code for hollow rectangle31

for (j = 1; j < = columns; j++)
0

for (j = 1; j < = columns; j++)
0
for (j = 1; j < = columns; j++)
4
for (j = 1; j < = columns; j++)
24
for (j = 1; j < = columns; j++)
25
for (j = 1; j < = columns; j++)
26________868______8
for (i = 1; i < = rows; i++)
55
for (j = 1; j < = columns; j++)
29
for (j = 1; j < = columns; j++)
30
for (i = 1; i < = rows; i++)
55
for (j = 1; j < = columns; j++)
32

for (j = 1; j < = columns; j++)
8
for (j = 1; j < = columns; j++)
4
for (j = 1; j < = columns; j++)
35
for (j = 1; j < = columns; j++)
25
for (j = 1; j < = columns; j++)
26________868______8
for (i = 1; i < = rows; i++)
55
for (j = 1; j < = columns; j++)
29
for (j = 1; j < = columns; j++)
30
for (i = 1; i < = rows; i++)
55
for (j = 1; j < = columns; j++)
32

********************
*                  *
*                  *
*                  *
*                  *
********************
3
********************
*                  *
*                  *
*                  *
*                  *
********************
4
for (j = 1; j < = columns; j++)
46
for (j = 1; j < = columns; j++)
47
for (j = 1; j < = columns; j++)
47
for (i = 1; i < = rows; i++)
55
for (j = 1; j < = columns; j++)
50
for (j = 1; j < = columns; j++)
24
for (j = 1; j < = columns; j++)
47________0______47 ________0______0_5_____4____5

________7______6

for (j = 1; j < = columns; j++)
35
for (j = 1; j < = columns; j++)
47
for (j = 1; j < = columns; j++)
47
for (i = 1; i < = rows; i++)
55
for (j = 1; j < = columns; j++)
50
for (j = 1; j < = columns; j++)
35
for (j = 1; j < = columns; j++)
47
for (j = 1; j < = columns; j++)
47 ________866______76

********************
*                  *
*                  *
*                  *
*                  *
********************
6
for (j = 1; j < = columns; j++)
67using8
********
*      *
*      *
*      *
*      *
*      *
*      *
********
0
for (j = 1; j < = columns; j++)
70
for (j = 1; j < = columns; j++)
47
for (j = 1; j < = columns; j++)
72

********************
*                  *
*                  *
*                  *
*                  *
********************
3
********
*      *
*      *
*      *
*      *
*      *
*      *
********
3
for (j = 1; j < = columns; j++)
75

********************
*                  *
*                  *
*                  *
*                  *
********************
6
for (j = 1; j < = columns; j++)
67using8
********
*      *
*      *
*      *
*      *
*      *
*      *
********
6
for (j = 1; j < = columns; j++)
70
for (j = 1; j < = columns; j++)
47
for (j = 1; j < = columns; j++)
72

for (j = 1; j < = columns; j++)
_8

for (j = 1; j < = columns; j++)
8
for (j = 1; j < = columns; j++)
67
for (j = 1; j < = columns; j++)
86

for (j = 1; j < = columns; j++)
_8

for (j = 1; j < = columns; j++)
_8

#include <bits/stdc++.h>_00

#include <bits/stdc++.h>_01

for (j = 1; j < = columns; j++)
88
for (j = 1; j < = columns; j++)
47 // C++ code for hollow rectangle20

#include <bits/stdc++.h>_05

 

for (j = 1; j < = columns; j++)
_95

C#




#include <bits/stdc++.h>_07

#include <bits/stdc++.h>_08

using

for (j = 1; j < = columns; j++)
97

 

for (i = 1; i < = rows; i++)
_34
for (i = 1; i < = rows; i++)
35

for (j = 1; j < = columns; j++)
0

for (j = 1; j < = columns; j++)
0#include <bits/stdc++.h>15

for (j = 1; j < = columns; j++)
0#include <bits/stdc++.h>17

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
40
for (i = 1; i < = rows; i++)
3 #include <bits/stdc++.h>21
for (i = 1; i < = rows; i++)
5
 if i == 1 or i == N or j == 1 or j == N
33

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
9

for (j = 1; j < = columns; j++)
8
for (i = 1; i < = rows; i++)
5
for (j = 1; j < = columns; j++)
2

for (j = 1; j < = columns; j++)
8
for (j = 1; j < = columns; j++)
4
for (j = 1; j < = columns; j++)
5

for (j = 1; j < = columns; j++)
8
for (i = 1; i < = rows; i++)
9

********************
*                  *
*                  *
*                  *
*                  *
********************
3
for (j = 1; j < = columns; j++)
4
 if i == 1 or i == N or j == 1 or j == N
46

********************
*                  *
*                  *
*                  *
*                  *
********************
3
for (i = 1; i < = rows; i++)
9

********************
*                  *
*                  *
*                  *
*                  *
********************
6
********************
*                  *
*                  *
*                  *
*                  *
********************
4
********************
*                  *
*                  *
*                  *
*                  *
********************
5

for (i = 1; i < = rows; i++)
_71#include <bits/stdc++.h>43

for (i = 1; i < = rows; i++)
_71#include <bits/stdc++.h>45

for (i = 1; i < = rows; i++)
_71
********************
*                  *
*                  *
*                  *
*                  *
********************
33
********
*      *
*      *
*      *
*      *
*      *
*      *
********
0
********
*      *
*      *
*      *
*      *
*      *
*      *
********
30

********************
*                  *
*                  *
*                  *
*                  *
********************
6
********
*      *
*      *
*      *
*      *
*      *
*      *
********
3

********************
*                  *
*                  *
*                  *
*                  *
********************
6
********************
*                  *
*                  *
*                  *
*                  *
********************
33
********
*      *
*      *
*      *
*      *
*      *
*      *
********
6
********
*      *
*      *
*      *
*      *
*      *
*      *
********
30

********************
*                  *
*                  *
*                  *
*                  *
********************
3
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

********************
*                  *
*                  *
*                  *
*                  *
********************
3
********************
*                  *
*                  *
*                  *
*                  *
********************
45

for (j = 1; j < = columns; j++)
8
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

for (j = 1; j < = columns; j++)
0

for (j = 1; j < = columns; j++)
0
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

for (j = 1; j < = columns; j++)
0

for (j = 1; j < = columns; j++)
0#include <bits/stdc++.h>67

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
98
for (i = 1; i < = rows; i++)
40
for (i = 1; i < = rows; i++)
3
********************
*                  *
*                  *
*                  *
*                  *
********************
56

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
9

for (j = 1; j < = columns; j++)
8
for (i = 1; i < = rows; i++)
5
 if i == 1 or i == N or j == 1 or j == N
77

for (j = 1; j < = columns; j++)
8#include <bits/stdc++.h>79

for (j = 1; j < = columns; j++)
0
********
*      *
*      *
*      *
*      *
*      *
*      *
********
9

********
*      *
*      *
*      *
*      *
*      *
*      *
********
_9

 

#include <bits/stdc++.h>_83

PHP




********************
*                  *
*                  *
*                  *
*                  *
********************
_68

#include <bits/stdc++.h>_85

#include <bits/stdc++.h>_08

 

#include <bits/stdc++.h>_15

#include <bits/stdc++.h>_17

________7______71 #include <bits/stdc++.h>21

********************
*                  *
*                  *
*                  *
*                  *
********************
73
********************
*                  *
*                  *
*                  *
*                  *
********************
76

for (i = 1; i < = rows; i++)
_9

for (j = 1; j < = columns; j++)
0
********************
*                  *
*                  *
*                  *
*                  *
********************
79
********
*      *
*      *
*      *
*      *
*      *
*      *
********
7

for (j = 1; j < = columns; j++)
0
********************
*                  *
*                  *
*                  *
*                  *
********************
82
********
*      *
*      *
*      *
*      *
*      *
*      *
********
7

for (j = 1; j < = columns; j++)
0
for (j = 1; j < = columns; j++)
4using8
********************
*                  *
*                  *
*                  *
*                  *
********************
79
********************
*                  *
*                  *
*                  *
*                  *
********************
88
********************
*                  *
*                  *
*                  *
*                  *
********************
79
********************
*                  *
*                  *
*                  *
*                  *
********************
90
********************
*                  *
*                  *
*                  *
*                  *
********************
73
********
*      *
*      *
*      *
*      *
*      *
*      *
********
7________7______79________7______94

for (j = 1; j < = columns; j++)
0
for (i = 1; i < = rows; i++)
9

for (j = 1; j < = columns; j++)
8
for (j = 1; j < = columns; j++)
4 using8
********************
*                  *
*                  *
*                  *
*                  *
********************
82
********************
*                  *
*                  *
*                  *
*                  *
********************
88
********************
*                  *
*                  *
*                  *
*                  *
********************
82
********************
*                  *
*                  *
*                  *
*                  *
********************
90
********************
*                  *
*                  *
*                  *
*                  *
********************
73
********
*      *
*      *
*      *
*      *
*      *
*      *
********
7________7______82________7______94

for (j = 1; j < = columns; j++)
8
for (i = 1; i < = rows; i++)
9

________7______3

********************
*                  *
*                  *
*                  *
*                  *
********************
4using8
********************
*                  *
*                  *
*                  *
*                  *
********************
79 using30
for (j = 1; j < = columns; j++)
50
********************
*                  *
*                  *
*                  *
*                  *
********************
79
********
*      *
*      *
*      *
*      *
*      *
*      *
********
16
********************
*                  *
*                  *
*                  *
*                  *
********************
73
for (j = 1; j < = columns; j++)
50 ________7______1______1

using38

********************
*                  *
*                  *
*                  *
*                  *
********************
82
********
*      *
*      *
*      *
*      *
*      *
*      *
********
16
********************
*                  *
*                  *
*                  *
*                  *
********************
73
for (j = 1; j < = columns; j++)
50
********************
*                  *
*                  *
*                  *
*                  *
********************
79
********
*      *
*      *
*      *
*      *
*      *
*      *
********
16
********************
*                  *
*                  *
*                  *
*                  *
********************
82
for (j = 1; j < = columns; j++)
50
********************
*                  *
*                  *
*                  *
*                  *
********************
82 using48
********************
*                  *
*                  *
*                  *
*                  *
********************
73 using50

Bagaimana Anda mencetak pola kotak persegi dengan python?

Pola - 9. Pola Persegi menggunakan angka .
baris = int(input("Masukkan jumlah baris. "))
untuk i dalam rentang(1, baris + 1)
untuk j dalam rentang(1, baris + 1)
# Periksa kondisi jika nilai j lebih kecil atau sama dengan
# j lalu cetak i jika tidak cetak j
jika j <= i
cetak(i, akhir=' ')

Bagaimana Anda mencetak pola dengan python?

Pola dapat dicetak dengan python menggunakan loop for sederhana . Loop luar pertama digunakan untuk menangani jumlah baris dan loop bersarang dalam digunakan untuk menangani jumlah kolom. Memanipulasi pernyataan cetak, pola angka yang berbeda, pola alfabet, atau pola bintang dapat dicetak.

Bagaimana Anda membuat kotak dalam kode python?

Langkah Membuat Kotak Entri menggunakan Tkinter .
Langkah 1. Buat Kanvas. Kanvas adalah tampilan tempat Anda dapat menempatkan item, seperti kotak entri, tombol, bagan, dan lainnya. .
Langkah 2. Tambahkan kotak entri. .
Langkah 3. Sertakan fungsi. .
Langkah 4. Tambahkan tombol. .
Langkah 5. Jalankan kode lengkap dengan Python

Bagaimana cara mencetak angka dalam pola persegi?

Logika deskriptif langkah demi langkah untuk mencetak pola bilangan kuadrat. .
Masukkan jumlah baris dari pengguna. .
Untuk mengulangi baris, jalankan loop luar dari 1 hingga N. .
Untuk beralih melalui kolom, jalankan loop dalam dari 1 hingga N. .
Cetak lingkaran dalam bagian dalam *
Setelah mencetak semua kolom baris pindah ke baris berikutnya i. e. mencetak baris baru