Answer to Question #265021 in Python for Raj

Question #265021

Write a program to print maximum and minimum prime numbers in a given range?


1
Expert's answer
2021-11-12T17:34:09-0500
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)

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
New on Blog
APPROVED BY CLIENTS