숭어 개발 블로그

[JAVA] 배열실습(3)_ 배열만큼 별찍기 본문

JAVA/배열 & 이차원배열

[JAVA] 배열실습(3)_ 배열만큼 별찍기

숭어싸만코 2022. 9. 21. 19:47
public class hw2_별 {

	public static void main(String[] args) {
		// TODO Auto-generated method stub

		//배열만큼 별찍기
		
		int[] starcount = {3,4,4,2,1};
		
		
		for(int i=0; i< starcount.length ; i++) {
			for(int j=1; j<=starcount[i]; j++) {
				System.out.print("*");
			}
			System.out.println();
		}

	}//

}//

 

int [ ] starcount = {3,4,4,2,1};

Comments