Computer Science, asked by 181616, 6 months ago

long answer Write a python program to find the whether a number is prime or not using 'while' loop . ​

Answers

Answered by Anonymous
4

#python program to check whether a number is prime

num = int(input(" Please Enter any Number: "))

count = 0 # keep counter as 0

i = 2

while(i <= num//2):

   if(num % i == 0):

       count = count + 1

       break

   i = i + 1

if (count == 0 and num != 1):

   print(num "is a Prime Number" %num)

else:

   print(" num, " is not a Prime Number" )

Similar questions