-직사각형 별찍기
1. 표준 입출력
Scanner sc = new Scanner(System.in)
int a = sc.nextInt();
System.out.print(); //줄바꿈 따로 없이 출력
System.out.println(); //줄바꿈
2. 내 소스
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();
int i,j;
for(i=0;i<b;i++){
for(j=0;j<a;j++){
System.out.print("*");
}
System.out.println();
}
}
}
'개발 > JAVA' 카테고리의 다른 글
[JAVA] level1 . 약수의 합 (0) | 2019.01.23 |
---|---|
[JAVA] level1 . 짝수와 홀수 (0) | 2019.01.23 |
[JAVA] level1 . 평균 구하기 / int[] arr , arr.length (0) | 2019.01.23 |
[JAVA] level1 . 서울에서 김서방 찾기 / String arr[], arr.length, arr[i], arr.equals (0) | 2019.01.23 |
[JAVA] level1 . 가운데 글자 가져오기 / length(), substring() (0) | 2019.01.23 |