[프로그래머스] 직사각형 별 찍기

이중 for문을 잘 이해하라!

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import java.util.Scanner;

public 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 j=0; j<a; j++){
System.out.print("*");
}
System.out.println();
}
}
}
Author

MoonDoni

Posted on

2020-01-26

Updated on

2020-01-26

Licensed under

댓글