코딩테스트(Level 0~1)
[JAVA, Programmers] 직사각형 별찍기(자바)
justdoIT0730
2022. 11. 21. 19:45
728x90
728x90
1. 문제 설명
이 문제에는 표준 입력으로 두 개의 정수 n과 m이 주어집니다.
별(*) 문자를 이용해 가로의 길이가 n, 세로의 길이가 m인 직사각형 형태를 출력해보세요.
2. 제한 조건
n과 m은 각각 1000 이하인 자연수입니다.
3. 예시
입력 : 5 3
출력 :
*****
*****
*****
import java.util.Scanner;
class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
for(int i=0; i<b; i++) {
for(int f=0; f<a; f++) {
System.out.print("*");
}
System.out.println();
}
}
}
728x90
728x90