import time
lo = int(input(“Enter lower range: “))
up = int(input(“Enter upper range: “))
print(“Prime numbers between”,lo,”&”,up,”are:t”)
start_time=time.time()
for n in range(lo,up + 1):

   if n > 1:
       for i in range(2,n):
           if (n % i) == 0:
               break
       else:
           print(“ttt”,n)
elapsed_time = time.time() – start_time 
print (“Time taken to calculate:”,elapsed_time)

Source link

Program to find prime numbers in a range and time taken to calculate

Leave a Reply

Your email address will not be published. Required fields are marked *