-
Notifications
You must be signed in to change notification settings - Fork 331
/
duck.java
54 lines (43 loc) · 1005 Bytes
/
duck.java
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import java.util.*;
class duck
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the no.");
int n=sc.nextInt();
int x=n;int k=0,t=0;
while(n!=0)
{
int d=n%10;
k++;
n=n/10;
}
int y=(int)(x%Math.pow(10,k));
if(y==0)
{
System.out.println("Not duck no.");
}
else
{
while(x!=0)
{
int e=x%10;
if(e==0)
{
t++;
break;
}
x=x/10;
}
if(t>0)
{
System.out.println(" duck no.");
}
else
{
System.out.println("Not duck no.");
}
}
}
}