Notice
Recent Posts
Recent Comments
Link
반응형
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- springboot
- 서버
- 백준
- 카카오코딩테스트
- DBA
- 인스턴스
- Swing
- DB
- Spring
- JavaScript
- 컬렉션프레임워크
- SQLP
- Oracle
- java
- 클라이언트
- 친절한 SQL 튜닝
- 자바
- socket
- 친절한 sql튜닝
- db버퍼캐시
- 클래스
- 메소드
- 코딩
- 깃허브
- 생성자
- 인덱스 튜닝
- 오라클
- 멀티쓰레드
- 상속
- SQL
Archives
- Today
- Total
프리 정보 컨텐츠
자바 별 찍기 예제 본문
반응형
for 문을 활용한 자바 별 찍기 예제 문제
public class Test
{
public static void main(String[] args) {
for(int i=1; i<=5; i++) {
for(int j=1; j<=i; j++) {
System.out.print("*");
}
System.out.println();
}
}
}
↓↓↓↓ 출력결과
*
**
***
****
*****
public class Test
{
public static void main(String[] args) {
for(int i=1; i<=5; i++) {
for(int k=5-i; k>0; k--) {
System.out.print(" ");
}
for(int j=1; j<=i; j++) {
System.out.print("*");
}
System.out.println();
}
}
}
↓↓↓↓ 출력결과
*
**
***
****
*****
public class Test
{
public static void main(String[] args) {
for(int i=1; i<=5; i++) {
for(int k=5-i; k>0; k--) {
System.out.print(" ");
}
for(int j=1; j<=i*2-1; j++) {
System.out.print("*");
}
System.out.println();
}
}
}
↓↓↓↓ 출력결과
*
***
*****
*******
*********
반응형
Comments