Write a program to print maximum and minimum prime numbers in a given range?
Maximum = -float('inf')
minimum = float('inf')
S =int(input("Enter the start range: "))
end = int(input("Enter the end range: "))
for i in range(S,end):
if i>1:
for j in range(2,i):
if(i % j==0):
break
else:
print(i)
given = i
INT = int(given)
if INT < minimum:
minimum = INT
if INT > Maximum:
Maximum = INT
print('the largest number is', Maximum)
print('the smallest number is', minimum)
Comments
Leave a comment