Skip to content

Instantly share code, notes, and snippets.

@elonmusk14
Created April 22, 2021 07:14
Show Gist options
  • Select an option

  • Save elonmusk14/46c8caea38a8def7395008af6f28b3e3 to your computer and use it in GitHub Desktop.

Select an option

Save elonmusk14/46c8caea38a8def7395008af6f28b3e3 to your computer and use it in GitHub Desktop.
check wheather the given number is primt or not
a = int(input("Enter a number: "))
prime = True
for i in range(2,a):
if (a%i == 0):
prime = False
if prime:
print(f"{a} is a prime number")
else:print(f"{a} is not a prime number")
@elonmusk14
Copy link
Author

this code check that the given number by user is prime or not

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment