# Python program to find a number is prime or composite

Hello people, welcome back! Here we discuss a python program which finds whether a given number is a prime number or composite number or neither of them.

Definition: A number which is greater than 1 is said to prime if it has no other factors other than 1 and itself. The numbers 0 and 1 are neither prime nor composite. And remaining all numbers are composite numbers.

#### Prime or Composite – Code Visualization

To find whether a number is prime or composite number.

#### Approach :

• Read input number using `input()`or`raw_input()`.
• Check if num is greater than 1.
• Find factors
• Run a for loop ranging from 2 to the num entered.
• check if num divided by any number gives a remainder 0.
• if it gives a remainder of 0, the number is not a prime number.
• if not, the number is a prime number.
• If number entered is either 0 or 1, we say that the number is neither prime nor composite number.
• All other numbers are composite numbers.
• Print the result.