Skip to content

Instantly share code, notes, and snippets.

@CodeByAidan
Created September 15, 2022 16:17
Show Gist options
  • Save CodeByAidan/09e4df8d7e6cddf429adc9b02e2b7e9a to your computer and use it in GitHub Desktop.
Save CodeByAidan/09e4df8d7e6cddf429adc9b02e2b7e9a to your computer and use it in GitHub Desktop.
checks whether a number is prime or not
# Check whether the number is prime or not
number = int(input('Enter a number : '))
counter = 0
for i in range (1, number + 1):
if(number % i == 0):
counter += 1;
if(counter == 2):
print(f"{number} is a Prime number")
else:
print(f"{number} is NOT a Prime number")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment