Python Program to Check Whether a Number is Prime or Not
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:
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
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
Post a Comment