while 1:
   
   s = input('请输入一个数:')
   s = int(s)
   if s == 2:
      print('质数')
   else:
      if s == 0 or s == 1:
         print('都不是')
      else:    
         u = s - 2
         h = 1
         p = 1
         while u:
            h = h + 1
            if s % h == 0:
               p = 1
               break
            else:
               p = 0
            u = u - 1
         if p:
            print('合数')
         else:
            print('质数')
               
            

 

相关文章:

  • 2022-02-05
  • 2022-01-17
  • 2021-11-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-21
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-24
  • 2022-12-23
  • 2021-12-21
相关资源
相似解决方案