Skip to content

Commit 1c3a0e2

Browse files
committed
prints number in increasing order for given n value, 1 to n, recursively
1 parent 7d88dca commit 1c3a0e2

File tree

1 file changed

+18
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)