Playground/자바문제집

[백준] 2439번

미숫가루설탕많이 2023. 1. 19. 22:37
import java.util.Scanner;

public class Main {
   public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);

      int count = sc.nextInt();
      sc.close();

      for (int i = 1; i <= count; i++) {
         // 공백 추가
         for (int j = 0; j < count - i; j++) {
            System.out.print(" ");
         }
         // 별 추가
         for (int k = 0; k < i; k++) {
            System.out.print("*");
         }
         System.out.println();
      }
   }
}

'Playground > 자바문제집' 카테고리의 다른 글

[백준] 1110번  (0) 2023.01.19
[백준] 10952번  (0) 2023.01.19
[백준] 2438번  (0) 2023.01.19
[백준] 11022번  (0) 2023.01.19
[백준] 11021번  (0) 2023.01.19