KSI일기장
프로그래머스 직삼각형 출력하기(*찍기, repeat()) (자바) 본문
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
String star = "*";
for(int i=1; i<=n; i++){
System.out.println(star);
star+="*";
}
}
}
import java.util.Scanner;
public class Solution {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for(int i=1; i<=n; i++){
System.out.println("*".repeat(i));
}
}
}
'JavaAlgorithm' 카테고리의 다른 글
프로그래머스 인덱스 바꾸기 (자바) (0) | 2023.12.05 |
---|---|
프로그래머스 가장 큰 수 찾기 (자바) (2) | 2023.12.04 |
프로그래머스 최댓값 만들기(2) (자바) Math.max , Integer.MIN_VALUE (1) | 2023.12.01 |
프로그래머스 가위 바위 보 (자바) (1) | 2023.11.30 |
프로그래머스 개미군단 (자바) (0) | 2023.11.30 |