Python Program to Find Number is Prime Or Not Using While Loop
What is Prime Number?
A number that is greater than One and divisible only by 1
and itself
For Example: 2, 3,
5,7,11,13,17, 19……..
Example: Code Program
num = int(input("Enter Nuber:"))
i = 2
f = -1
while i < num:
if num%i == 0:
f = f+1
i = i+1
if f == -1:
print(num, "is Prime Number")
else:
print(num, "is Not Prime Number")
i = 2
f = -1
while i < num:
if num%i == 0:
f = f+1
i = i+1
if f == -1:
print(num, "is Prime Number")
else:
print(num, "is Not Prime Number")
Output:
Java Program to Find Number is Prime Or Not
Post a Comment