

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Write a python program to check a number whether it is prime or not.
n=int(input('Enter a number: ')) flag=True for i in range(2,n): if n==2: break elif n%i==0: flag=False break if flag==True: print(n,"is a Prime number")
else: print(n,"is not a prime number")
Enter a number: 12 12 is not a prime number Enter a number: 3 3 is a Prime number
The python program to check whether a number is prime or not is successfully completed and the output is verified.