Skip to content

Commit 7d88dca

Browse files
committed
prints number decresing to increasing order recursively
1 parent 7691cac commit 7d88dca

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package Recursion;
2+
3+
public class printDecreasingIncreasing {
4+
5+
public static void main(String[] args) {
6+
7+
int n = 5;
8+
printDecInc(n);
9+
}
10+
11+
public static void printDecInc(int n) {
12+
if (n == 0) {
13+
return;
14+
}
15+
System.out.println(n);
16+
printDecInc(n - 1);
17+
System.out.println(n);
18+
}
19+
}

0 commit comments

Comments
 (0)