FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
NumberPrograms/LuckyNumber_22.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
/
LuckyNumber_22.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
26 lines (26 loc) · 694 Bytes
Breadcrumbs
NumberPrograms
/
LuckyNumber_22.java
Copy path
File metadata and controls
26 lines (26 loc) · 694 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
import
java
.
io
.*;
class
LuckyNumber_22
{
static
int
gap
=
2
;
public
static
void
main
(
String
args
[])
throws
IOException
{
InputStreamReader
in
=
new
InputStreamReader
(
System
.
in
);
BufferedReader
br
=
new
BufferedReader
(
in
);
System
.
out
.
print
(
"N = "
);
int
n
=
Integer
.
parseInt
(
br
.
readLine
());
for
(
int
i
=
1
;
i
<=
n
;
i
++){
if
(
isLucky
(
i
))
System
.
out
.
print
(
i
+
"
\t
"
);
gap
=
2
;
}
}
public
static
boolean
isLucky
(
int
n
){
if
(
gap
>
n
)
return
true
;
else
if
(
n
%
gap
==
0
)
return
false
;
n
=
n
-
n
/
gap
;
gap
++;
return
isLucky
(
n
);
}
}
Back
|
FazBrowse Home
|
New Git URL