Skip to content

Commit 791394d

Browse files
authored
Update Count Zeros
1 parent 95855a5 commit 791394d

File tree

1 file changed

+20
-0
lines changed
  • Course 2 - Data Structures in JAVA/Recursion Assignment

1 file changed

+20
-0
lines changed

Course 2 - Data Structures in JAVA/Recursion Assignment/Count Zeros

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,23 @@ Sample Input 3 :
2626
Sample Output 3 :
2727
4
2828
*/
29+
30+
public class solution {
31+
32+
public static int countZerosRec(int input){
33+
// Write your code here
34+
if (input==0)
35+
{
36+
return 0;
37+
}
38+
int smallOutput=countZerosRec(input/10);
39+
if (input%10==0)
40+
{
41+
return smallOutput+1;
42+
}
43+
else
44+
{
45+
return smallOutput;
46+
}
47+
}
48+
}

0 commit comments

Comments
 (0)