def prime(start,end):
primes = []
for i in range(start,end+1):
flag = True
if i>1:
if i == 0:
flag = False
for j in range(2,i):
if i%j == 0:
flag = False
break
if flag:
primes.append(i)
return primes
start = int(input('Enter start point: '))
end = int(input('Enter end point: '))
primes = prime(start,end)
print(primes)
primes = []
for i in range(start,end+1):
flag = True
if i>1:
if i == 0:
flag = False
for j in range(2,i):
if i%j == 0:
flag = False
break
if flag:
primes.append(i)
return primes
start = int(input('Enter start point: '))
end = int(input('Enter end point: '))
primes = prime(start,end)
print(primes)
ScreenShot:
No comments:
Post a Comment