별 찍기 Java Code
- 아래를 찍으시오.
*****
*****
*****
*****
*****
public class Main {
public static void main(String[] args) {
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5; j++) {
System.out.print("*");
}
System.out.println();
}
}
}
- 아래를 찍으시오.
*
**
***
****
*****
public class Main {
public static void main(String[] args) {
for (int i = 0; i < 5; i++) {
for (int j = 0; j <= i; j++) {
System.out.print("*");
}
System.out.println();
}
}
}
- 아래를 찍으시오.
*****
****
***
**
*
public class Main {
public static void main(String[] args) {
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5 - i - 1; j++) {
System.out.print(" ");
}
for (int k = 0; k <= i; k++) {
System.out.print("*");
}
System.out.println();
}
}
}
- 아래를 찍으시오.
*
**
***
****
*****
public class Main {
public static void main(String[] args) {
for (int i = 0; i < 5; i++) {
for (int j = 0; j < 5 - i - 1; j++) {
System.out.print(" ");
}
for (int k = 0; k <= i; k++) {
System.out.print("*");
}
System.out.println();
}
}
}
- 아래를 찍으시오.
*****
****
***
**
*
public class Main {
public static void main(String[] args) {
for (int i = 0; i < 5; i++) {
for (int j = 0; j < i; j++) {
System.out.print(" ");
}
for (int k = 0; k < 5 - i; k++) {
System.out.print("*");
}
System.out.println();
}
}
}