Answer to Question #287949 in Python for Srinivas Thumma

Question #287949

1


2


6


8


3


These integers in range find the prime number

1
Expert's answer
2022-01-16T09:03:25-0500
# Python program to display all the prime numbers within an interval

lower = int(input(''))
upper = int(input(''))

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

for num in range(lower, upper + 1):
   # all prime numbers are greater than 1
   if num > 1:
       for i in range(2, num):
           if (num % i) == 0:
               break
       else:
           print(num)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS