JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
public class Program
{
public static void main(String[] args) {
System.out.println(
"*** Hash Star Pyramid Pattern ***\n");
// Enter the number of rows :
int num = 5;
for(int rows=1; rows<=6; rows++,num--){
/** First Pyramid */
for(int count=1;count<=num;count++){
System.out.print(" #");
}
/** Second Pyramid */
for(int count=1;count<=rows;count++){
if(count == 1){
System.out.print(" *");
} else {
System.out.print(" #");
}
}
/** Third Pyramid */
for(int count=rows;count>1;count--){
if(count == 2){
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run