Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Sep 7, 2025. It is now read-only.
/pythonPublic archive

UPDATED THE GCD FUNCTION AND MADE IT MORE EFFICIENT#146

Open
DEVIL-NEEL wants to merge1 commit intoAllAlgorithms:master
base:master
Choose a base branch
Loading
fromDEVIL-NEEL:master
Open
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletionsalgorithms/math/gcd.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
def gcd(A, B):
if B>A:
A, B = B, A
while B!=0:
temp = B
B = A%B
A = temp
return A
#EUCLIDEAN ALGORITHM FOR GCD CALCULATION
def computeGCD(x,y):
while(y):
x,y= y, x % y
return abs(x)

print(gcd(10,20))
print(computeGCD(10,20))

[8]ページ先頭

©2009-2025 Movatter.jp