{"id":7193,"date":"2021-09-30T10:30:12","date_gmt":"2021-09-30T05:00:12","guid":{"rendered":"https:\/\/python-programs.com\/?p=7193"},"modified":"2021-11-22T18:35:34","modified_gmt":"2021-11-22T13:05:34","slug":"python-program-to-check-a-number-is-prime-or-not","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-check-a-number-is-prime-or-not\/","title":{"rendered":"Python Program to Check a Number is Prime or Not"},"content":{"rendered":"

Grab the opportunity to learn all effective java programming language concepts from basic to advance levels by practicing these Java Program Examples with Output<\/a><\/p>\n

Factors of a number:<\/strong><\/p>\n

When two whole numbers are multiplied, the result is a product. The factors of the product are the numbers we multiply.<\/p>\n

In mathematics, a factor is a number or algebraic expression that equally divides another number or expression, leaving no remainder.<\/p>\n

Prime Number:<\/strong><\/p>\n

A prime number is a positive integer greater than 1 that has no other variables except 1 and the number itself. Since they have no other variables, the numbers 2, 3, 5, 7, and so on are prime numbers.<\/p>\n

Given a number , the task is to check whether the given number is prime or not.<\/p>\n

Examples:<\/strong><\/p>\n

Example 1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

number =5<\/pre>\n

Output:<\/strong><\/p>\n

The given number 5 is prime number<\/pre>\n

Example 2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

number =8<\/pre>\n

Output:<\/strong><\/p>\n

The given number 8 is not prime number<\/pre>\n

Example 3:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

number =2<\/pre>\n

Output:<\/strong><\/p>\n

The given number 2 is not prime number<\/pre>\n

Program to Check Prime Number in Python Programming<\/h2>\n

Below are the ways to check whether the given number is prime or not:<\/p>\n