Python program to check prime number
Python program to check prime number The program gets a number as input from the user and checks whether the given number is prime or not. A prime number is a number that can be divided exactly itself and one. For example, consider number 7, 7 divides only by 1 and 7. so it is a prime number. In other terms, the factors of 7 are 1 and 7 only. So a number having two factors, one and the number itself are called as prime numbers. Now consider number 6, The factors of 6 include 1, 2, 3, and 6. The factors don't obey the rule of prime numbers as it's having factors other than 1 and 6. Sample input 0 : 5 Sample output 0 : Prime number Sample input 1 : 6 Sample output 1 : Not a prime number Sample input 2 : 1 Sample output 2 : Neither prime nor composite Procedure : 1. Start. 2. create a function to check if the number is prime => initialize a flag variable as 0. => loop from 2 to n/2. => check if the number is divisible by any number in between 2 and n/2.