Advertisement
borkins

07. Christmas Tree

Apr 5th, 2017
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1. /**
  2.  * Project: Drawing_With_Loops - created by borkins on 2017-04-01.
  3.  */
  4.  
  5. import java.util.Scanner;
  6.  
  7. public class _07_ChristmasTree
  8. {
  9.     public static void main(String[] args)
  10.     {
  11.         Scanner console = new Scanner(System.in);
  12.         StringBuilder stars = new StringBuilder();
  13.        
  14.         int n = Integer.parseInt(console.nextLine());
  15.    
  16.         for (int i = 0; i <= n; i++)
  17.         {
  18.             for (int j = i; j < n; j++) {
  19.                 System.out.print(" ");
  20.             }
  21.             System.out.println(stars + " | " + stars);
  22.             stars.append("*");
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement