-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReverseTringle.java
More file actions
41 lines (38 loc) · 838 Bytes
/
ReverseTringle.java
File metadata and controls
41 lines (38 loc) · 838 Bytes
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
import java.util.Scanner;
public class ReverseTringle
{
static void row(int i, int n)
{
if(i <=n)
{
space(1,i,n);
col(2 * n -1,i);
System.out.println();
row(i+1, n);
}
}
static void space(int j , int i ,int n)
{
if(j < i)
{
System.out.print(" ");
space(j+1 , i, n);
}
}
static void space(int j , int i )
{
if(j >=2*i-1)
{
System.out.print("*");
col(j-1 ,i);
}
}
public static void main(String[] args)
{
Scanner in = new Scanner(System.in);
System.out.println("Enter Any Size ");
int n = in.nextInt();
row(1, n);
in.close();
}
}