Prime Number Program in Python

Prime Number Program in Python



Code:

num = int(input("enter number to check is it prime : "))

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")
else:
    print(num, " is  not a prime number")




Output:


enter number to check is it prime : 50
50  is  not a prime number
>>


Video Tutorial:





Post a Comment

Previous Post Next Post