728x90
문제
내 코드
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
for(int i = 0;i<n;i++){
for(int j = 0;j<i;j++){
System.out.print(" ");
}
for(int k = n-i;k>0;k--){
System.out.print("*");
}
System.out.println();
}
}
}
뭔가 다른 방법이 있었던 거 같은데 기억이 안나부러
728x90
'with my rubber duck > codingTest' 카테고리의 다른 글
[프로그래머스] 가운데 글자 가져오기 (0) | 2022.06.02 |
---|---|
백준 2442 자바 (0) | 2022.04.18 |
백준 자바 별 찍기 - 3 (0) | 2022.04.15 |
백준 2439 별 찍기 - 2 풀기 (0) | 2022.04.11 |
백준 2438 별 찍기 - 1 껌이지~ (0) | 2022.04.06 |
댓글