Write a program in python to check for prime number

#wap and check the no. is prime or not
                          #take no. from user
x = int(input("enter a no. "))
for i in range(2,x):
    if x % i==0:
        print("not prime")
        break
else:
        print("prime no.")
output-
Python 3.8.5 (tags/v3.8.5:580fbb0, Jul 20 2020, 15:43:08) [MSC v.1926 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> 
= RESTART: C:\Users\Dell\AppData\Local\Programs\Python\Python38-32\break statement prime no. proagpram.py
enter a no. 11
prime no.
>>> 

Leave a Reply

Back To Top