Skip to content

Commit

Permalink
Merge pull request #1 from esouidi/esouidi-patch-74
Browse files Browse the repository at this point in the history
Issue dscmbcet#74 print primes with for loop
  • Loading branch information
esouidi authored Dec 5, 2021
2 parents 6a61145 + c6c4f9c commit cb43a18
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Language/python/Program1/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,20 @@ def print_primes(lower_limit: int, upper_limit: int) -> None:

lower_limit += 1


def print_primes_with_for(lower_limit: int, upper_limit: int) -> None:
for i in range(lower_limit, upper_limit + 1):
if i > 1:
interval = 2
for k in range(interval, i):
if i % k == 0:
break
else:
print(i)

# Taking inputs

lower = int(input("Lower Limit: "))
upper = int(input("Upper Limit: "))

print_primes(lower, upper)
print_primes_with_for(lower, upper)

0 comments on commit cb43a18

Please sign in to comment.