def getMax(arr, n):
          # If there is only one element then return it as min
          if n == 1:
              max = arr[0]
              return max
          # If there are more than one elements, then initialize min
          max = arr[0]
          for i in range(1, n):
              if arr[i] > max:
                  max = arr[i]
          return max
      # Driver Code
      if __name__ == "__main__":
          arr = [10, 11, 45, 89, 33, 30]
          arr_size = 6
          max = getMax(arr, arr_size)
          print("Maximum element is", max)
      
      Python language logo

      Maximum Element

      Find maximum element from a list of elements

      0 Comments

        Add Comment

        Log in to add a comment

        Codiga - All rights reserved 2022.