برنامه های kmm,bmm,.....
BMM
n=raw_input('enter a number:')
m=raw_input('enter a number:')
a=int(n)
b=int(m)
##cnt = int(x/2)
##while cnt>0:
## if x%cnt==0 and y%cnt==0:
## print 'The greatest common divisor is: ',cnt
## break
## cnt = cnt -1
x = a
y = b
r = x%y
while r > 0:
r = x%y
x = y
y = r
print a*b/x
K
n=raw_input ('Enter the number: ')
x=int(n)
i=1
A=0
while (i
A=A+1
i=i+1
print A
KMM
a=int(raw_input('enter a number:'))
b=int(raw_input('enter a number:'))
cnt =1
while cnt <= b:
if cnt*a%b==0:
print cnt*a
break
cnt = cnt + 1
M
n=row-input
N
n=raw_input("enter a number: ")
m=raw_input("enter a number: ")
x=int(n)
y=int(m)
##cnt = 1
##while cnt<=x/2 :
## if x%cnt==0 and y%cnt==0:
## gcd = cnt
## cnt = cnt+1
##print 'Greatest Common Divosor= ',gcd
cnt = x/2
while cnt>0 :
if x%cnt==0 and y%cnt==0:
break
cnt = cnt-1
print 'Greatest Common Divosor= ',cnt
sqrt
##x = 16
##ans = 0
##if x>=0:
## while ans*ans
## print 'ans =', ans
## if ans * ans !=x:
## print x,'is not a perfect square!'
## else: print ans
##else: print x , 'is a negative number'
def sqrt(x):
## return the squre root of x, if x is a perfect square
## print the error message and return None otherwise
ans = 0
if x>=0:
while ans*ans
print x,'is not a perfect square!'
return None
else: return ans
else:
print x , 'is a negative number'
return None