Created
July 24, 2016 06:44
-
-
Save Nishan8583/808dced6e29e18c60f4f4a5d5883ac5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check_number(): | |
give = int(input('Enter the number you want to check is prime or not : ')) # asking input andconverting it into integer since by default it will be string | |
give1 = int(give/2) # we know a number greater than the half of that number won't be able to divide it | |
# COnveriting into integer because the result will be float | |
for i in range(1,give1): | |
if give % i == 0: | |
print('THe number {} is prime'.format(give)) | |
break # since there is now no pint in continuing the if loop | |
else: | |
print('The number {} is not prime {}'.format(give)) | |
check_number() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment