Advertisement
Spocoman

07. Christmas Tree

Aug 31st, 2024
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.38 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class ChristmasTree {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int n = Integer.parseInt(scanner.nextLine());
  7.         for (int i = 0; i <= n; i++) {
  8.             System.out.printf("%s%s | %s%s\n", " ".repeat(n - i), "*".repeat(i), "*".repeat(i), " ".repeat(n - i));
  9.         }
  10.     }
  11. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement