Created
September 15, 2022 16:17
-
-
Save CodeByAidan/09e4df8d7e6cddf429adc9b02e2b7e9a to your computer and use it in GitHub Desktop.
checks whether a number is prime or not
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
# 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