**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.

1 2 3 4 5 6 7 8 9 | n= int(input( "enter the number that has to be checked:")) a=0 for i in range(2,int((n/2))): if(n%i ==0): //finding whether the number has a factor or not a=a+1 if(a>1): print("it is not prime number.") else: print("it is prime number.") |

**Output**

1 2 3 4 5 | 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.

- What are the differences between undeclared and undefined variables?
- How to pass props on routes to child components by react router?
- How to find all indices of a number using C++?
- How to concatenate or merge arrays in Swift?
- How to get date for each post?
- Flutter showDialog with navigator key rather than passing context
- How to declare defaultProps on a React component class using TypeScript?
- VIRUS Full Form | What is the Full Form VIRUS?
- How to convert date to another timezone in JavaScript?
- How do you programatically scroll a ‘ScrollView’ widget?
- What is Minification
- Explain about the famous database packages used in Flutter?
- ReactJS onClick event returning all null values
- How to use refs to change styling class in ReactJS?
- How to use the SlideTransition in Flutter?

We use cookies to ensure that we give you the best experience and use cookies in order to personalize the advertising that you see on our website. Read more about our Privacy Policy.Got it!