We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4e379c8 commit d6f1ca1Copy full SHA for d6f1ca1
Recursion/Reach Destination/ReachDestination.java
@@ -0,0 +1,34 @@
1
+import java.util.*;
2
+
3
+class ReachDestination{
4
5
+ static void ReachDest(int source, int destination){
6
7
+ System.out.println("Source : " + source + "Destination : " + destination);
8
9
+ // base case
10
11
+ if(source == destination){
12
+ System.out.println("REACHED");
13
+ return;
14
+ }
15
16
+ // processing - ek agge badhane k liye
17
18
+ source++;
19
20
+ // recursive call
21
+ ReachDest(source, destination);
22
23
24
25
+ public static void main(String[] args){
26
27
+ Scanner scn = new Scanner(System.in);
28
29
+ int source = scn.nextInt();
30
+ int destination = scn.nextInt();
31
32
33
34
+}
0 commit comments