import math
      arr = [10, 13, 17, 11, 34, 21]
      first = math.inf
      second = math.inf
      for i in range(0, len(arr)):
         if arr[i] < first:
           first = arr[i]
      for i in range(0, len(arr)):
         if arr[i] != first and arr[i] < second:
           second = arr[i]
      print(second)
      
      Python language logo

      Find Second Smallest Element in an Array

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.