FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
NumberPrograms/Duck_No.java at main · javaistic/NumberPrograms · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
javaistic
/
NumberPrograms
Public
forked from
arghyaxcodes/NumberPrograms
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
NumberPrograms
/
Duck_No.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
32 lines (29 loc) · 764 Bytes
Breadcrumbs
NumberPrograms
/
Duck_No.java
Copy path
File metadata and controls
32 lines (29 loc) · 764 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
import
java
.
util
.*;
class
Duck_No
{
// Function to check whether
// the given number is duck number or not.
static
boolean
check_duck
(
String
num
)
{
// Ignore leading 0s
int
i
=
0
,
n
=
num
.
length
();
while
(
i
<
n
&&
num
.
charAt
(
i
) ==
'0'
)
i
++;
// Check remaining digits
while
(
i
<
n
) {
if
(
num
.
charAt
(
i
) ==
'0'
)
return
true
;
i
++;
}
return
false
;
}
// Driver Method
public
static
void
main
(
String
args
[])
{
String
num
=
"1023"
;
if
(
check_duck
(
num
))
System
.
out
.
println
(
"It is a duck number"
);
else
System
.
out
.
println
(
"It is not a duck number"
);
}
}
Back
|
FazBrowse Home
|
New Git URL