diff --git a/README.md b/README.md index 1955f71..39ac805 100644 --- a/README.md +++ b/README.md @@ -154,6 +154,7 @@ * * ***************** ``` + 15.Hollow Diamond Pattern ``` * * * * * * * * * * @@ -166,4 +167,19 @@ * * * * * * * * * * * * * * * * * * * * * * * * + ``` +16.Christmas Tree Pattern +``` + * + *** + ***** + ******* + ********* + *********** +************* + * + * + * + +``` \ No newline at end of file diff --git a/src/ChristmasTreePattern/ChristmasTree.java b/src/ChristmasTreePattern/ChristmasTree.java new file mode 100644 index 0000000..6b72a78 --- /dev/null +++ b/src/ChristmasTreePattern/ChristmasTree.java @@ -0,0 +1,27 @@ +package ChristmasTreePattern; + +public class ChristmasTree { + public static void main(String[] args) { + int height = 7; + + for (int i = 1; i <= height; i++) { + for (int j = 1; j <= height - i; j++) { + System.out.print(" "); + } + + for (int j = 1; j <= 2 * i - 1; j++) { + System.out.print("*"); + } + + System.out.println(); + } + + + for (int i = 1; i <= height / 2; i++) { + for (int j = 1; j <= height - 1; j++) { + System.out.print(" "); + } + System.out.println("*"); + } + } +} \ No newline at end of file