Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to find gcd of n numbers in python

#My Python Lectures: https://cutt.ly/python-full-playlist
#Codechef Problem Solution Video: https://cutt.ly/codeChefContestProblemSolution
import math
num = [2,3,4,5,6,7]
res = num[0]
for i in range(1, len(num), 1):
    res = math.gcd(res, num[i])
print(res)
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #find #gcd #numbers #python
ADD COMMENT
Topic
Name
1+1 =