Python program to print all Prime numbers in an Interval

Asked: Anonymously |Category: Python

lower = eval(input("Enter lower value"))

upper = eval(input("Enter upper value"))


print("Prime numbers between", lower, "and", upper, "are:")


for num in range(lower, upper + 1):

if num > 1:

for i in range(2, num):

if (num % i) == 0:

break

else:

print(num)

15 views0 comments

Recent Posts

See All

Binary string reduction in Python

Asked: Sudeep |Category: Python x=int(input("Enter the value of x : ")) for i in range(x): n=int(input("Enter the value of n : ")) y=input("Enter the value of y : ") l=list(y) k=0

"Believe you can and you're halfway there"