Computer Science, asked by patelkeshav1976email, 1 month ago

Write a python program ....


input a number and check if the number is a prime or composite number.​

Answers

Answered by ShepardN7
0

Code:

n = int(input("Enter a number to check if it's prime or composite:"))

x = 0

for i in range(1,n+1):

   if n%i == 0:

      x += 1        

if x > 2:

   print(n,"is composite")

else:

   print(n,"is prime")

Hope this helps you!

Similar questions