1 Dimension Education is a Free Educational Blog by Professor Nipun Sharma. Domains include Machine Learning, Artificial Intelligence ,Electronics and Communication, Instrumentation, Computer Science and Electrical Engineering. Lecture Notes and Sample Script Files of YouTube Videos are available for FREE !
7 Thought-Provoking Free Python Programs that will sharpen your Learning Curve
1. Usage of Article (A , An ) in English
Easy Python Program to Find LCM of N - numbers
Section 1
Find LCM of 3 Numbers:
*************************************************************
a = int(input(" Enter 1 number : "))b = int(input(" Enter 2 number : "))
c = int(input(" Enter 3 number : "))
l =[a,b,c]
m = max(l)
#print(m)
while (1):
if (m % a == 0 and m % b == 0 and m % c == 0 ):
print("The LCM is :" , m)
break
m = m+1
**************************************************************
Section 2
Find LCM of n-Numbers
**************************************************************
x = input("Enter numbers separated by space ")l = x.split(" ")
print(l)
w = []
for i in range(len(l)):
num = int(l[i])
w.append(num)
print(w)
m = max(w)
print(m)
print(all(w))
print(len(w))
while True:
z = []
for j in range(len(w)):
r = m % w[j]
z.append(r)
#print(z)
if sum(z)==0:
print("LCM is ", m)
break
else:
m = m+1
Subscribe to:
Posts (Atom)
-
1. Create a Wired Loop Network (Kind of Ring Network) The network link breaks somewhere in between and the link becomes up after some tim...
-
# Create scheduler #Create an event scheduler wit multicast turned on set ns [new Simulator -multicast on] #$ns multicast ...
A Compendium of Epigrams Vol:1
Buy From Amazon Kindle Edition Sneak Peak of Second BOOK