Advertisement
Guest User

Untitled

a guest
Feb 26th, 2017
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Pr07ChristmasTreeNoMethod {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int n = Integer.parseInt(scanner.nextLine());
  7.  
  8.         char[] line = new char[n * 2 + 3];
  9.         for (int i = 0; i < line.length; i++) {
  10.             line[i] = ' ';
  11.         }
  12.         line[n + 1] = '|';
  13.  
  14.         for (int i = 0; i <= n; i++) {
  15.             if ( i > 0 ) {
  16.                 line[n - i] = '*';
  17.                 line[n + 2 + i] = '*';
  18.             }
  19.             System.out.println(line);
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement