별 출력하기
public class Quiz_06 {
	public static void main(String[] args) {
		for(int j=5;j>0;j--) {
			for(int i=j;i>0;i--) {
				System.out.print("☆");
			}
			System.out.println();
		}
		
		
		System.out.println();

/*
 		 
====   Q3  =====
☆☆☆☆☆
  ☆☆☆☆
    ☆☆☆
      ☆☆
        ☆
                
                
*****         j=5 ?=0 i=1,2,3,4,5
a****         j=4 ?=1 i=1,2,3,4   
aa***        j=3  ?=2 i=1,2,3
aaa**        j=2  ?=3 i=1,2
aaaa*        j=1  ?=4 i=1  
*/ 

		for(int k=5;k>0;k--) {
			for(int l=5;l>0;l--) {
				//for(int m=0;m<k-l;m++)
				//{
				//	System.out.print(" ");
					
				//}
				//if문으로 공백과 별을 별도로 준다면?
				//if(5-l)
				System.out.print("★");
			}
			System.out.println();

		}
	
		
		
		
	}
}

'자바 프로그래밍 > 코드' 카테고리의 다른 글

예외처리 문법(try-catch문)  (0) 2020.02.11
계산기 프로그램  (0) 2020.02.11
이중반목문(이중for문)  (0) 2020.02.11
1 ~ n까지 합구하기 (while문)  (0) 2020.02.11
구구단 출력 프로그램 (while문)  (0) 2020.02.11