Skip to content

Instantly share code, notes, and snippets.

@penut85420
Created May 5, 2018 16:10
Show Gist options
  • Save penut85420/29e7e850eb41883e5652cb6c74c8d295 to your computer and use it in GitHub Desktop.
Save penut85420/29e7e850eb41883e5652cb6c74c8d295 to your computer and use it in GitHub Desktop.
isPrime = False
while isPrime == False:
number1 = eval(input("請輸入一個數值: "))
isPrime = True
k = 2
while k < number1 and isPrime:
if number1 % k == 0:
isPrime = False
k += 1
if isPrime == True:
print(str(number1), "為質數")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment