July 26, 2018

Prime number in python

A python program to find prime number

Program


num = int(input("Enter a number : "))
print("Prime numbers from {} to {} are ".format(1, num))
for i in range(2, num):
    for j in range(2, i):
        if i % j == 0:
            break
    else:
        print(i, end=" ")

Output


Facebook comments