-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDuck.java
More file actions
29 lines (24 loc) · 671 Bytes
/
Copy pathDuck.java
File metadata and controls
29 lines (24 loc) · 671 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package Program;
import java.util.Scanner;
public class Duck {
public int duck(int n){
if (n==0)
return 0;
else {
if (n%10== 0)
return (1+ duck(n/10));
else
return duck(n/10);
}
}
public static void main(String[] args) {
Duck obj = new Duck();
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int a = obj.duck(n);
if (a!=0)
System.out.println("Duck");
else
System.out.println("Not Duck");
}
}