-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathRhombus.java
More file actions
44 lines (40 loc) · 1.12 KB
/
Rhombus.java
File metadata and controls
44 lines (40 loc) · 1.12 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
Do you want to continue?: y
Enter the no. of rows: 5
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
*/
import java.util.Scanner;
public class Rhombus
{
public static void main(String[] args)
{
outer:
while(true)
{
System.out.println();
Scanner a = new Scanner(System.in);
char y;
System.out.print("Enter the no. of rows: ");
int r = a.nextInt();
for(int i=1;i<=r;i++)
{
for(int j=1;j<=r-i;j++)
{
System.out.print(" ");
}
for(int j=1;j<=r;j++)
{
System.out.print("*"+" ");
}
System.out.println();
}
System.out.print("\nDo you want to continue?: ");
y = a.next().charAt(0);
if (y == 'N' || y == 'n')
{
break outer;
} } } }