Java Star Pattern Problems
| Problem 1 | Problem 2 | Problem 3 | Problem 4 | Problem 5 | Problem 6 | Problem 7 |
| * ** @@T6 1@@*** **** ***** |
***** **** *** ** * |
***** @@ T112@@**** @@T119 @@*** **@ @T127@@ * |
* *** ***** |
***** *** * |
* *** ***** *** * |
***********9 ********8 *******7 ******6 @ @T201@@*****5 ****4 ***3 **2 *1 |
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
//문제 1.
System.out.println("\n== 문제 1 ==");
for(int a=1; a<6; a++) {
for (int b=0; b<a; b++) {
System.out.print("*");
}
System.out.println("");
}
//문제 2.
System.out.println("\n== 문제 2 ==");
for(int a=1; a<6; a++) {
for(int b=5; b>a; b--) {
System.out.print(" ");
}
for (int c=0; c<a; c++) {
System.out.print("*");
}
System.out.println("");
}
//문제 3.
System.out.println("\n== 문제 3 ==");
for(int a=6; a>1; a--) {
for (int b=1; b<a; b++) {
System.out.printf("%s","*");
}
System.out.println("");
}
//문제 4.
System.out.println("\n== 문제 4 ==");
for(int a=1; a<6; a++) {
for(int b=3; b>a; b--) {
System.out.print(" ");
}
if(a%2==0) continue;
for (int c=0; c<a; c++) {
System.out.print("*");
}
System.out.println("");
}
//문제 5.
System.out.println("\n==문제 5 ==");
for(int a=0; a<5; a++) {
for(int b=1; b<=a; b++) {
System.out.print(" ");
}
for (int c=5; c>=a*2+1; c--) {
System.out.print("*");
}
System.out.println("");
}
//문제 6.
System.out.println("\n== 문제 6 ==");
for(int a=1; a<4; a++) {
for(int b=3; b>a; b--) {
System.out.print(" ");
}
for (int c=0; c<a*2-1; c++) {
System.out.print("*");
}
System.out.println("");
}
for(int a=0; a<3; a++) {
for(int b=1; b<a+2; b++) {
System.out.print(" ");
}
for (int c=4; c>a*2+1; c--) {
System.out.print("*");
}
System.out.println("");
}
//문제7.
System.out.println("\n== 문제 7 ==");
int a1,b;
for(a1=9; a1>0; a1--) {
for (b=0; b<a1; b++) {
System.out.print("*");
}
System.out.println(a1);
}
|
cs |
You might also like…
8 Sep
GPT-6 Astra: What the Benchmarks Actually Show
5min25 Aug
Unreal MCP: How Claude Code Now Drives the Unreal Editor Directly
5min25 Aug
When Do AI Glasses Developer Platforms Actually Open? A 2026 Timeline
4min6 Jul
3D Gaussian Splatting vs Unreal Engine: Two Ways to Build a 3D World - and Where Each One Ships
7min2 Jul