代码如下:

"""                                            
# _*_coding:utf-8_*_                           
Name:gys.py                                    
Date:1/14/19                                   
Author:westos-sql                              
Connect:[email protected]                      
Desc:...                                       
"""                                            
                                               
Num1 = int(input('please input one num:'))     
Num2 = int(input('please input another num:')) 
Min_Num = min(Num1, Num2)                      
for i in range(1, Min_Num + 1):                
    if Num1 % i == 0 and Num2 % i == 0:        
       GCD = i                                 
    LCM = (Num1 * Num2) / GCD                  
print('GCD is: %d LCM is: %d' % (GCD, LCM))    

python实现最大公约数最小公倍数求法

测试:
python实现最大公约数最小公倍数求法
python实现最大公约数最小公倍数求法
python实现最大公约数最小公倍数求法

相关文章:

  • 2021-11-27
  • 2021-12-19
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-20
  • 2022-12-23
  • 2021-12-19
  • 2022-12-23
  • 2021-09-22
  • 2022-02-04
相关资源
相似解决方案