230821 직사각형 별찍기

Jongleee·2023년 8월 21일
0

TIL

목록 보기
343/576
public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	int a = sc.nextInt();
	int b = sc.nextInt();

	StringBuilder sb = new StringBuilder();
	for (int i = 0; i < a; i++) {
		sb.append("*");
	}

	for (int i = 0; i < b; i++) {
		System.out.println(sb);
	}
}

출처:https://school.programmers.co.kr/learn/courses/30/lessons/12969

0개의 댓글