(int n)
| 2 | |
| 3 | public class Main { |
| 4 | static void printDecreasing(int n){ // 5 4 3 2 1 |
| 5 | //base case |
| 6 | if(n == 1){ |
| 7 | System.out.println(1); |
| 8 | return; |
| 9 | } |
| 10 | |
| 11 | // self work |
| 12 | System.out.println(n); // n |
| 13 | |
| 14 | // recursive work |
| 15 | printDecreasing(n-1); // n-1, n-2,.....1 |
| 16 | |
| 17 | } |
| 18 | |
| 19 | static void printIncreasing(int n){ // 1, 2, ..... n-1, n |
| 20 | //base case |