import java.util.Scanner;
public class DuckNumber {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter a number: ");
String input = sc.next();
boolean isDuck = false;
if(input.charAt(0) != '0') {
for(int i=1; i<input.length(); i++) {
if(input.charAt(i) == '0') {
isDuck = true;
break;
}
}
}
if(isDuck) {
System.out.println(input + " is a Duck number");
} else {
System.out.println(input + " is not a Duck number");
}
sc.close();
}
}
Enter a number: 2030
2030 is a Duck number
Enter a number: 137
137 is not a Duck number
0
' or not. If it is, then the number is not a Duck number. If it's not, we move on to the next step.0
' present. If there is, then the number is a Duck number.