문제 설명
이 문제에는 표준 입력으로 두 개의 정수 n과 m이 주어집니다.
별(*) 문자를 이용해 가로의 길이가 n, 세로의 길이가 m인 직사각형 형태를 출력해보세요.
제한 조건
- n과 m은 각각 1000 이하인 자연수입니다.
예시

import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int m = sc.nextInt();
for(int i = 1; i <= m; i++){
for(int j = 1; j <= n; j++){
System.out.print("*");
}
System.out.println();
}
}
}
'Algorithm > 프로그래머스' 카테고리의 다른 글
[프로그래머스] x만큼 간격이 있는 n개의 숫자 (level 1) (0) | 2021.05.11 |
---|---|
[프로그래머스] 체육복 (탐욕법 Greedy level 1) (0) | 2021.05.08 |
[프로그래머스] 예산 (level 1) (0) | 2021.05.08 |
[프로그래머스] 소수 만들기 (level 1) (0) | 2021.05.08 |
[프로그래머스] 크레인 인형뽑기 게임 (스택 level 1) (0) | 2021.05.06 |