We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f692ae6 commit 095a677Copy full SHA for 095a677
Recursion/PatternRightAngleTriangle.java
@@ -0,0 +1,47 @@
1
+package Recursion;
2
+
3
+public class PatternRightAngleTriangle {
4
5
+ static void downPattern(int row,int col) {
6
+ if(row==-1)
7
+ return;
8
+ if(row == col){
9
+ System.out.println();
10
+ downPattern(row-1, 0);
11
+ }
12
+ else{
13
+ System.out.print("* ");
14
+ downPattern(row,col+1);
15
16
17
+ static void upPattern(int row,int col) {
18
19
20
21
+ upPattern(row-1, 0);
22
23
24
25
+ upPattern(row,col+1);
26
27
28
29
+ public static void main(String[] args) {
30
+ downPattern(4,0);
31
+ upPattern(4, 0);
32
33
+}
34
35
36
+//output
37
+// * * * *
38
+// * * *
39
+// * *
40
+// *
41
42
43
44
45
46
47
0 commit comments