Computer Science, asked by avks, 1 year ago

write a programme to check wheather a no. is prime or not in python

Answers

Answered by tejasgupta
8

Heya !!

Here's the code...

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`

num = int(input("enter a number: "))

 

for i in range(2, int(num/2)):

   if num % i  == 0:

       print("not prime number")

       break

else:

   print("prime number")

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~``

Hope it helps !!

Similar questions