write a python program to accept a number from the user then check whether it is prime number or composite
Answers
Answered by
1
Answer:
num = int(input("Enter a number: "))
if num > 1:
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")
else:
print(num,"is not a prime number")
Similar questions
Political Science,
2 months ago
Environmental Sciences,
2 months ago
Math,
4 months ago
Science,
4 months ago
Chemistry,
9 months ago
Science,
9 months ago