Advertisement
tripTiPscout

Christmas Tree

Nov 11th, 2022
729
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.50 KB | None | 0 0
  1. package Training;
  2.  
  3. public class Main {
  4.  
  5.     public static void main(String[] args) {
  6.  
  7.         for (int i = 1; i <= 5; i++) {
  8.             for (int j = 1; j <= 5 - i; j++) {
  9.                 System.out.print(" ");
  10.             }
  11.             System.out.print("*");
  12.             for (int k = 1; k <= i * 2 - 3; k++) {
  13.                 System.out.print("-");
  14.             }
  15.             if (i > 1) {
  16.                 System.out.print("*");
  17.             }
  18.             System.out.println();
  19.         }
  20.  
  21.     }
  22. }
  23.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement