728x90
문제
https://www.acmicpc.net/problem/2438
2438번: 별 찍기 - 1
첫째 줄에는 별 1개, 둘째 줄에는 별 2개, N번째 줄에는 별 N개를 찍는 문제
www.acmicpc.net
풀이
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
for (int i = 1; i <= n ; i++) {
for (int j = 0; j < i; j++) {
System.out.print("*");
}
System.out.println();
}
}
}
'백준 문제풀기 > 반복문' 카테고리의 다른 글
[Java] 백준 10952 A+B - 5 (0) | 2022.11.14 |
---|---|
[Java] 백준 2438 별 찍기 - 2 (0) | 2022.11.14 |
[Java] 백준 11022 A+B - 8 (0) | 2022.11.14 |
[Java] 백준 11021 A+B-7 (0) | 2022.11.14 |
[Java] 백준 25304 영수증 (0) | 2022.11.14 |