Skip to content

Commit

Permalink
Merge pull request #8 from jcgaming-official/master
Browse files Browse the repository at this point in the history
Created Christmas Tree Pattern
  • Loading branch information
Yashkapure06 authored Oct 14, 2023
2 parents e02fe01 + 271e2c4 commit 62f26f5
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
* *
*****************
```

15.Hollow Diamond Pattern
```
* * * * * * * * * *
Expand All @@ -166,4 +167,19 @@
* * * * * *
* * * * * * * *
* * * * * * * * * *
```
16.Christmas Tree Pattern
```
*
***
*****
*******
*********
***********
*************
*
*
*
```
27 changes: 27 additions & 0 deletions src/ChristmasTreePattern/ChristmasTree.java
Original file line number Diff line number Diff line change
@@ -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("*");
}
}
}

0 comments on commit 62f26f5

Please sign in to comment.