FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
NumberPrograms/Amicable_Number.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
/
Amicable_Number.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
26 lines (24 loc) · 750 Bytes
Breadcrumbs
NumberPrograms
/
Amicable_Number.java
Copy path
File metadata and controls
26 lines (24 loc) · 750 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
.
util
.*;
class
Amicable_Number
{
public
static
void
main
(
String
Args
[]) {
Scanner
sc
=
new
Scanner
(
System
.
in
);
System
.
out
.
println
(
"Enter two numbers"
);
System
.
out
.
print
(
"Enter first number: "
);
int
n1
=
sc
.
nextInt
();
System
.
out
.
print
(
"Enter second number: "
);
int
n2
=
sc
.
nextInt
();
int
i
,
s1
=
0
,
s2
=
0
;
for
(
i
=
1
;
i
<
n1
;
i
++) {
if
(
n1
%
i
==
0
)
s1
=
s1
+
i
;
}
for
(
i
=
1
;
i
<
n2
;
i
++) {
if
(
n2
%
i
==
0
)
s2
=
s2
+
i
;
}
if
(
s1
==
n2
&&
s2
==
n1
)
System
.
out
.
println
(
"Amicable Number"
);
else
System
.
out
.
println
(
"Not an Amicable Number"
);
}
}
Back
|
FazBrowse Home
|
New Git URL