Computer Science, asked by thanujloganathan, 2 months ago

num =input('enter the number:')

If (int(num)%2)==1:

print(num, is prime number")

else:

print (num,"is not prime number")​

Answers

Answered by portugalindia567
0

Answer:

# Program to check if a number is prime or not

num = 407

# To take input from the user

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

# 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 numbe

Answered by raghvendrark500
2

Answer:

# Program to check if a number is prime or not

num = 407

# To take input from the user

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

# 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")

Similar questions