Skip to content

Commit

Permalink
Merge pull request #61 from CodesOfAnurag/HCF
Browse files Browse the repository at this point in the history
HCF of multiple elements
  • Loading branch information
akshitagupta15june authored Sep 25, 2020
2 parents 1ec7ec3 + ca4b92f commit 1eb70ec
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 13 additions & 0 deletions Maths/HCF.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
def calcHCF(a,b):
return b if a%b==0 else calcHCF(b, a%b)

if __name__ == '__main__':

n = int(input())
arr = list(map(int, input().split()))
hcf = calcHCF(arr[0], arr[1])

for i in range(2, len(arr)):
hcf = calcHCF(hcf, arr[i])

print(hcf)
1 change: 0 additions & 1 deletion Maths/add

This file was deleted.

0 comments on commit 1eb70ec

Please sign in to comment.