MCPcopy Create free account
hub / github.com/Manvityagi/PW-Skills-Java-Course-Codes / printDecreasing

Method printDecreasing

Lecture 27/src/Main.java:4–17  ·  view source on GitHub ↗
(int n)

Source from the content-addressed store, hash-verified

2
3public 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

Callers 1

mainMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected