Skip to content

求素数

lvxin edited this page Jun 19, 2018 · 1 revision
#!/usr/bin/python
# -*- coding: UTF-8 -*-
 
i = 2
while(i < 100):
   j = 2
   while(j <= (i/j)):
      if not(i%j): break
      j = j + 1
   if (j > i/j) : print(i, " 是素数")
   i = i + 1

Clone this wiki locally