Answer to Question #209430 in Electrical Engineering for mona

Question #209430

write python program to print prime number between any two number m to n


1
Expert's answer
2021-06-22T05:10:34-0400
 # Python program to display all the prime numbers between m and n

m=int(input("Enter value of m:"))

n=int(input("Enter value of n:"))

print("Prime numbers between", m, "and", n, "are:")

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

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

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS