FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Java/gcd.java at main · Eggy115/Java · GitHub
Eggy115
/
Java
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
5
Star
3
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
Java
/
gcd.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
19 lines (14 loc) · 406 Bytes
Breadcrumbs
Java
/
gcd.java
Copy path
File metadata and controls
19 lines (14 loc) · 406 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
class
gcd
{
public
static
void
main
(
String
[]
args
) {
// find GCD between n1 and n2
int
n1
=
81
,
n2
=
153
;
// initially set to gcd
int
gcd
=
1
;
for
(
int
i
=
1
;
i
<=
n1
&&
i
<=
n2
; ++
i
) {
// check if i perfectly divides both n1 and n2
if
(
n1
%
i
==
0
&&
n2
%
i
==
0
)
gcd
=
i
;
}
System
.
out
.
println
(
"GCD of "
+
n1
+
" and "
+
n2
+
" is "
+
gcd
);
}
}
Back
|
FazBrowse Home
|
New Git URL