返回列表 發帖
  1. def compute(x):
  2.     c=0
  3.     for i in range(1,x+1):
  4.         if x % 2 == 0:
  5.             c+=1
  6.     if(c==2):
  7.         return 1
  8.     else:
  9.         return 0
  10. x=int(input())
  11. t=compute(x)
  12. if(t==1):
  13.     print(f"{x} is a prime number")
  14. else:
  15.     print(f"{x} is not a prime number")
複製代碼

TOP

返回列表