Answer to Question #208955 in Electrical Engineering for mona

Question #208955

Write and execute a PYTHON program to perform the following tasks.

1.Write a program in python to print prime numbers between any two numbers m to n.


1
Expert's answer
2021-06-22T05:08:42-0400
m=int(input('Enter m: '))
n=int(input('Enter n: '))
if(n<=m):
    print('Error: Enter n>m.')
else:
    print('Prime numbers are:')
    for number in range(m,n):
        isPrime=True
        if number > 1:
            for i in range(2, number):
                if (number % i) == 0:
                    isPrime=False
                    break
            if isPrime:
                print(str(number))





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
APPROVED BY CLIENTS