Skip to content

Commit c10bd85

Browse files
committed
Practice Done.
Signed-off-by: Someshdiwan <Someshdiwan369@gmail.com>
1 parent 30ee4e3 commit c10bd85

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+
public class RecursionIsAwsome {
2+
public static void main(String[] args)
3+
{
4+
sayHi(5);
5+
}
6+
public static void sayHi(int n) {
7+
//Need a Base Case.
8+
//Base case means when to stop. printing infinite times.
9+
if(n==0) {
10+
System.out.println("Done!");
11+
}
12+
else {
13+
System.out.println("Hi");
14+
n--;
15+
sayHi(n);
16+
}
17+
}
18+
}

0 commit comments

Comments
 (0)