Write a python program to print all prime number between m and n. M and n needs to be supplied to the functions from the main program.
Answers
Answered by
1
Answer:
- The task is to write a Python program to print all Prime numbers in an Interval. Definition: A prime number is a natural number greater than 1 that has no positive ... a for loop and for every number, if it is greater than 1, check if it divides n. ... Absolute difference between the Product of Non-Prime numbers and ...
Answered by
3
def prime(n):
if(n<2):
return False
for i in range(2,n//2+1):
if (n%i==0):
return False
return True
m=int(input("Enter the lower limit:"))
n=int(input("Enter the higher limit:"))
for x in range(m,n):
if prime(x):
print(x,end=' ')
Similar questions