2024-10-22



*******
*******
*******
*******
*
**
***
****
*****
******
*******
*******
******
*****
****
***
**
*
package basic;
/*
* 아래와 같이 화면에 출력해 보자.
*
* 1.
* *******
* *******
* *******
* *******
*
* 2.
* *
* **
* ***
* ****
* *****
*
* 3.
* *****
* ****
* ***
* **
* *
*/
public class ForExam_27 {
public static void main(String[] args) {
// 1번 별 찍기
for(int i = 1; i <= 4; i++) { // 별 찍기 에서는 행
for(int j =1; j <=7; j++) { // 별 찍기 에서는 열
System.out.print("*");
}
System.out.println();
}
System.out.println();
System.out.println();
// 2번 별 찍기
for(int i = 1; i <= 7; i++) {
for(int j = 1; j <= i; j++) {
System.out.print("*");
}
System.out.println();
}
System.out.println();
System.out.println();
// 3번 별 찍기
for(int i = 7; i >= 1; i--) {
for(int j = 1; j <= i; j++) {
System.out.print("*");
}
System.out.println();
}
}
}'Java > 기초 내용 정리' 카테고리의 다른 글
| Java(Control)_Continue_29 (0) | 2024.10.22 |
|---|---|
| Java(Control)_Break_28 (0) | 2024.10.22 |
| Java(Control)_For_26 (0) | 2024.10.22 |
| Java(Control)_For_25 (0) | 2024.10.22 |
| Java(Control)_For_24 (0) | 2024.10.22 |