Question Write a Python program to check if the number is prime or not?
Answer: Example to check whether an integer is a prime number or not.
n= int(input( "enter the number that has to be checked:"))
for i in range(2,int((n/2))):
if(n%i ==0): //finding whether the number has a factor or not
print("it is not prime number.")
print("it is prime number.")
enter the number that has to be checked:97
it is prime number.
enter the number that has to be checked: 54
it is not prime number.
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.