F Program to calculate Prime Number using Python | CodeTheta

Program to calculate Prime Number using Python

June 14, 2018

Code :
Number = int(input("Enter a number to check: "))

if Number > 1:
    for i in range(2,Number):
        if (Number % i) == 0:
            print("Not a prime number.")
            break
    else:
        print("Prime number.")
else:
    print("Not a prime number.")

Output :
Enter a number to check: 57
Not a prime number.

IDE Used To Test This Code : Python IDLE.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Post a Comment