Skip to content

Commit ab89543

Browse files
committed
Half Pyramid using * in Java
1 parent c0c93ed commit ab89543

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Halfpyramid.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import java.util.Scanner;
2+
class Main {
3+
4+
public static void main(String[] args)
5+
{
6+
Scanner s=new Scanner(System.in);
7+
System.out.print("ENTER THE NO OF ROWS:");
8+
int rows =s.nextInt();
9+
for (int i = 1; i <= rows; i++) {
10+
for (int j = 1; j <= i; j++) {
11+
System.out.print("* ");
12+
}
13+
System.out.println();
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)