Numer kaczki w Javie
import java.util.*;
class duck
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
System.out.println("Enter Number: ");
String num = sc.next();
int c = 0, d;
int l = num.length();
for(int i = 1; i < l; i++)
{
d = num.charAt(i);
if(d == '0')
{
c++;
}
}
int f = num.charAt(0);
if(c > 0 && f != 0)
{
System.out.println("Duck Number.");
}
else
{
System.out.println("Not a Duck Number.");
}
sc.close();
}
}
Poised Parrot