Header Ads

Python Program to Check Whether a Number is Prime or Not


Prime, python, primer number, python prime number, check number is primer or not, python program  to check number is prime or not, Python Program to Check Whether a Number is Prime or Not, Even, odd, python, program, even number, odd number, python program, check number is even, check number is odd, python program to check number is even, python program to check number is odd, Python Program to Check Whether a Number is EVEN or ODD

What is Prime Number ??

A number that is divisible by only 1 and itself. And its value is greater than 1.


A positive whole number greater than 1 which has no other factors Except 1 and the number itself is called a prime number.
e.g
2, 3, 5, 7 , 11, 13,……

Source Code Example:


num = int(input("Enter number:"))
if num>1:
   
for i in range(2,num):
       
if (num%i) == 0:
           
print(num, " is not a prime number")
           
break
        else
:
           
print(num, "is a prime number")
           
break
else
:
   
print(num, " is not a prime number"
)



Related Video 




Questions : Write a program


1. python program to check given number is prime or not
2. python program to check whether number is prime or not
3. python program to check if number is prime or not
4. python program to check whether given number is prime or not
5. python program to check if the input number is prime or not
6. python program to check a number is prime or not
7. python program to check if a number is prime or not

No comments

Powered by Blogger.