Skip to content

Conversation

@SuperLakshya
Copy link

An easy and faster way to solve the same problem

num = int(input("Enter number:"))

To take input from the user

prime numbers are greater than 1

if num > 1:

check for factors

for i in range(2,num):
if (num % i) == 0:
print(num,"is not a prime number")
print(i,"times",num//i,"is",num)
break
else:
print(num,"is a prime number")

if input number is less than

or equal to 1, it is not prime

else:
print(num,"is not a prime number")

An easy and faster way to solve the same problem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant